├── .gitignore ├── Demo ├── GCPagedScrollViewDemo.xcodeproj │ └── project.pbxproj └── GCPagedScrollViewDemo │ ├── GCPagedScrollViewDemo-Info.plist │ ├── GCPagedScrollViewDemo-Prefix.pch │ ├── GCPagedScrollViewDemoAppDelegate.h │ ├── GCPagedScrollViewDemoAppDelegate.m │ ├── GCPagedScrollViewDemoViewController.h │ ├── GCPagedScrollViewDemoViewController.m │ ├── en.lproj │ ├── GCPagedScrollViewDemoViewController.xib │ ├── InfoPlist.strings │ └── MainWindow.xib │ └── main.m ├── GCPagedScrollView ├── GCPagedScrollView.h └── GCPagedScrollView.m ├── LICENSE.txt └── README.textile /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac OS X 2 | *.DS_Store 3 | 4 | # Xcode 5 | *.pbxuser 6 | *.mode1v3 7 | *.mode2v3 8 | *.perspectivev3 9 | *.xcuserstate 10 | project.xcworkspace/ 11 | xcuserdata/ 12 | 13 | # Generated files 14 | build/ 15 | *.[oa] 16 | *.pyc 17 | 18 | # Backup files 19 | *~.nib -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B0CFE641136C70E700AFA05C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0CFE640136C70E700AFA05C /* UIKit.framework */; }; 11 | B0CFE643136C70E700AFA05C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0CFE642136C70E700AFA05C /* Foundation.framework */; }; 12 | B0CFE645136C70E700AFA05C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0CFE644136C70E700AFA05C /* CoreGraphics.framework */; }; 13 | B0CFE64B136C70E700AFA05C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B0CFE649136C70E700AFA05C /* InfoPlist.strings */; }; 14 | B0CFE64E136C70E700AFA05C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B0CFE64D136C70E700AFA05C /* main.m */; }; 15 | B0CFE651136C70E700AFA05C /* GCPagedScrollViewDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B0CFE650136C70E700AFA05C /* GCPagedScrollViewDemoAppDelegate.m */; }; 16 | B0CFE654136C70E700AFA05C /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = B0CFE652136C70E700AFA05C /* MainWindow.xib */; }; 17 | B0CFE657136C70E700AFA05C /* GCPagedScrollViewDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B0CFE656136C70E700AFA05C /* GCPagedScrollViewDemoViewController.m */; }; 18 | B0CFE65A136C70E800AFA05C /* GCPagedScrollViewDemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B0CFE658136C70E800AFA05C /* GCPagedScrollViewDemoViewController.xib */; }; 19 | B0CFE66B136C711100AFA05C /* GCPagedScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = B0CFE66A136C711100AFA05C /* GCPagedScrollView.m */; }; 20 | B0CFE66E136C742A00AFA05C /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0CFE66D136C742A00AFA05C /* QuartzCore.framework */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | B0CFE63C136C70E700AFA05C /* GCPagedScrollViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GCPagedScrollViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | B0CFE640136C70E700AFA05C /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 26 | B0CFE642136C70E700AFA05C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 27 | B0CFE644136C70E700AFA05C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 28 | B0CFE648136C70E700AFA05C /* GCPagedScrollViewDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GCPagedScrollViewDemo-Info.plist"; sourceTree = ""; }; 29 | B0CFE64A136C70E700AFA05C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 30 | B0CFE64C136C70E700AFA05C /* GCPagedScrollViewDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GCPagedScrollViewDemo-Prefix.pch"; sourceTree = ""; }; 31 | B0CFE64D136C70E700AFA05C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32 | B0CFE64F136C70E700AFA05C /* GCPagedScrollViewDemoAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GCPagedScrollViewDemoAppDelegate.h; sourceTree = ""; }; 33 | B0CFE650136C70E700AFA05C /* GCPagedScrollViewDemoAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GCPagedScrollViewDemoAppDelegate.m; sourceTree = ""; }; 34 | B0CFE653136C70E700AFA05C /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; 35 | B0CFE655136C70E700AFA05C /* GCPagedScrollViewDemoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GCPagedScrollViewDemoViewController.h; sourceTree = ""; }; 36 | B0CFE656136C70E700AFA05C /* GCPagedScrollViewDemoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GCPagedScrollViewDemoViewController.m; sourceTree = ""; }; 37 | B0CFE659136C70E800AFA05C /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/GCPagedScrollViewDemoViewController.xib; sourceTree = ""; }; 38 | B0CFE669136C711100AFA05C /* GCPagedScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCPagedScrollView.h; sourceTree = ""; }; 39 | B0CFE66A136C711100AFA05C /* GCPagedScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCPagedScrollView.m; sourceTree = ""; }; 40 | B0CFE66D136C742A00AFA05C /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | B0CFE639136C70E700AFA05C /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | B0CFE66E136C742A00AFA05C /* QuartzCore.framework in Frameworks */, 49 | B0CFE641136C70E700AFA05C /* UIKit.framework in Frameworks */, 50 | B0CFE643136C70E700AFA05C /* Foundation.framework in Frameworks */, 51 | B0CFE645136C70E700AFA05C /* CoreGraphics.framework in Frameworks */, 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | B0CFE631136C70E700AFA05C = { 59 | isa = PBXGroup; 60 | children = ( 61 | B0CFE668136C711100AFA05C /* GCPagedScrollView */, 62 | B0CFE646136C70E700AFA05C /* GCPagedScrollViewDemo */, 63 | B0CFE63F136C70E700AFA05C /* Frameworks */, 64 | B0CFE63D136C70E700AFA05C /* Products */, 65 | ); 66 | sourceTree = ""; 67 | }; 68 | B0CFE63D136C70E700AFA05C /* Products */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | B0CFE63C136C70E700AFA05C /* GCPagedScrollViewDemo.app */, 72 | ); 73 | name = Products; 74 | sourceTree = ""; 75 | }; 76 | B0CFE63F136C70E700AFA05C /* Frameworks */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | B0CFE66D136C742A00AFA05C /* QuartzCore.framework */, 80 | B0CFE640136C70E700AFA05C /* UIKit.framework */, 81 | B0CFE642136C70E700AFA05C /* Foundation.framework */, 82 | B0CFE644136C70E700AFA05C /* CoreGraphics.framework */, 83 | ); 84 | name = Frameworks; 85 | sourceTree = ""; 86 | }; 87 | B0CFE646136C70E700AFA05C /* GCPagedScrollViewDemo */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | B0CFE655136C70E700AFA05C /* GCPagedScrollViewDemoViewController.h */, 91 | B0CFE656136C70E700AFA05C /* GCPagedScrollViewDemoViewController.m */, 92 | B0CFE647136C70E700AFA05C /* Supporting Files */, 93 | ); 94 | path = GCPagedScrollViewDemo; 95 | sourceTree = ""; 96 | }; 97 | B0CFE647136C70E700AFA05C /* Supporting Files */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | B0CFE658136C70E800AFA05C /* GCPagedScrollViewDemoViewController.xib */, 101 | B0CFE64F136C70E700AFA05C /* GCPagedScrollViewDemoAppDelegate.h */, 102 | B0CFE650136C70E700AFA05C /* GCPagedScrollViewDemoAppDelegate.m */, 103 | B0CFE652136C70E700AFA05C /* MainWindow.xib */, 104 | B0CFE648136C70E700AFA05C /* GCPagedScrollViewDemo-Info.plist */, 105 | B0CFE649136C70E700AFA05C /* InfoPlist.strings */, 106 | B0CFE64C136C70E700AFA05C /* GCPagedScrollViewDemo-Prefix.pch */, 107 | B0CFE64D136C70E700AFA05C /* main.m */, 108 | ); 109 | name = "Supporting Files"; 110 | sourceTree = ""; 111 | }; 112 | B0CFE668136C711100AFA05C /* GCPagedScrollView */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | B0CFE669136C711100AFA05C /* GCPagedScrollView.h */, 116 | B0CFE66A136C711100AFA05C /* GCPagedScrollView.m */, 117 | ); 118 | name = GCPagedScrollView; 119 | path = ../GCPagedScrollView; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | B0CFE63B136C70E700AFA05C /* GCPagedScrollViewDemo */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = B0CFE65D136C70E800AFA05C /* Build configuration list for PBXNativeTarget "GCPagedScrollViewDemo" */; 128 | buildPhases = ( 129 | B0CFE638136C70E700AFA05C /* Sources */, 130 | B0CFE639136C70E700AFA05C /* Frameworks */, 131 | B0CFE63A136C70E700AFA05C /* Resources */, 132 | ); 133 | buildRules = ( 134 | ); 135 | dependencies = ( 136 | ); 137 | name = GCPagedScrollViewDemo; 138 | productName = GCPagedScrollViewDemo; 139 | productReference = B0CFE63C136C70E700AFA05C /* GCPagedScrollViewDemo.app */; 140 | productType = "com.apple.product-type.application"; 141 | }; 142 | /* End PBXNativeTarget section */ 143 | 144 | /* Begin PBXProject section */ 145 | B0CFE633136C70E700AFA05C /* Project object */ = { 146 | isa = PBXProject; 147 | attributes = { 148 | LastUpgradeCheck = 0420; 149 | ORGANIZATIONNAME = LittleKiwi; 150 | }; 151 | buildConfigurationList = B0CFE636136C70E700AFA05C /* Build configuration list for PBXProject "GCPagedScrollViewDemo" */; 152 | compatibilityVersion = "Xcode 3.2"; 153 | developmentRegion = English; 154 | hasScannedForEncodings = 0; 155 | knownRegions = ( 156 | en, 157 | ); 158 | mainGroup = B0CFE631136C70E700AFA05C; 159 | productRefGroup = B0CFE63D136C70E700AFA05C /* Products */; 160 | projectDirPath = ""; 161 | projectRoot = ""; 162 | targets = ( 163 | B0CFE63B136C70E700AFA05C /* GCPagedScrollViewDemo */, 164 | ); 165 | }; 166 | /* End PBXProject section */ 167 | 168 | /* Begin PBXResourcesBuildPhase section */ 169 | B0CFE63A136C70E700AFA05C /* Resources */ = { 170 | isa = PBXResourcesBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | B0CFE64B136C70E700AFA05C /* InfoPlist.strings in Resources */, 174 | B0CFE654136C70E700AFA05C /* MainWindow.xib in Resources */, 175 | B0CFE65A136C70E800AFA05C /* GCPagedScrollViewDemoViewController.xib in Resources */, 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | }; 179 | /* End PBXResourcesBuildPhase section */ 180 | 181 | /* Begin PBXSourcesBuildPhase section */ 182 | B0CFE638136C70E700AFA05C /* Sources */ = { 183 | isa = PBXSourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | B0CFE64E136C70E700AFA05C /* main.m in Sources */, 187 | B0CFE651136C70E700AFA05C /* GCPagedScrollViewDemoAppDelegate.m in Sources */, 188 | B0CFE657136C70E700AFA05C /* GCPagedScrollViewDemoViewController.m in Sources */, 189 | B0CFE66B136C711100AFA05C /* GCPagedScrollView.m in Sources */, 190 | ); 191 | runOnlyForDeploymentPostprocessing = 0; 192 | }; 193 | /* End PBXSourcesBuildPhase section */ 194 | 195 | /* Begin PBXVariantGroup section */ 196 | B0CFE649136C70E700AFA05C /* InfoPlist.strings */ = { 197 | isa = PBXVariantGroup; 198 | children = ( 199 | B0CFE64A136C70E700AFA05C /* en */, 200 | ); 201 | name = InfoPlist.strings; 202 | sourceTree = ""; 203 | }; 204 | B0CFE652136C70E700AFA05C /* MainWindow.xib */ = { 205 | isa = PBXVariantGroup; 206 | children = ( 207 | B0CFE653136C70E700AFA05C /* en */, 208 | ); 209 | name = MainWindow.xib; 210 | sourceTree = ""; 211 | }; 212 | B0CFE658136C70E800AFA05C /* GCPagedScrollViewDemoViewController.xib */ = { 213 | isa = PBXVariantGroup; 214 | children = ( 215 | B0CFE659136C70E800AFA05C /* en */, 216 | ); 217 | name = GCPagedScrollViewDemoViewController.xib; 218 | sourceTree = ""; 219 | }; 220 | /* End PBXVariantGroup section */ 221 | 222 | /* Begin XCBuildConfiguration section */ 223 | B0CFE65B136C70E800AFA05C /* Debug */ = { 224 | isa = XCBuildConfiguration; 225 | buildSettings = { 226 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 227 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 228 | GCC_C_LANGUAGE_STANDARD = gnu99; 229 | GCC_OPTIMIZATION_LEVEL = 0; 230 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG; 231 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 232 | GCC_VERSION = com.apple.compilers.llvmgcc42; 233 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 234 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 235 | GCC_WARN_UNUSED_VARIABLE = YES; 236 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 237 | SDKROOT = iphoneos; 238 | }; 239 | name = Debug; 240 | }; 241 | B0CFE65C136C70E800AFA05C /* Release */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 245 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 246 | GCC_C_LANGUAGE_STANDARD = gnu99; 247 | GCC_VERSION = com.apple.compilers.llvmgcc42; 248 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 249 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 250 | GCC_WARN_UNUSED_VARIABLE = YES; 251 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 252 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 253 | SDKROOT = iphoneos; 254 | }; 255 | name = Release; 256 | }; 257 | B0CFE65E136C70E800AFA05C /* Debug */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | COPY_PHASE_STRIP = NO; 262 | GCC_DYNAMIC_NO_PIC = NO; 263 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 264 | GCC_PREFIX_HEADER = "GCPagedScrollViewDemo/GCPagedScrollViewDemo-Prefix.pch"; 265 | INFOPLIST_FILE = "GCPagedScrollViewDemo/GCPagedScrollViewDemo-Info.plist"; 266 | PRODUCT_NAME = "$(TARGET_NAME)"; 267 | WRAPPER_EXTENSION = app; 268 | }; 269 | name = Debug; 270 | }; 271 | B0CFE65F136C70E800AFA05C /* Release */ = { 272 | isa = XCBuildConfiguration; 273 | buildSettings = { 274 | ALWAYS_SEARCH_USER_PATHS = NO; 275 | COPY_PHASE_STRIP = YES; 276 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 277 | GCC_PREFIX_HEADER = "GCPagedScrollViewDemo/GCPagedScrollViewDemo-Prefix.pch"; 278 | INFOPLIST_FILE = "GCPagedScrollViewDemo/GCPagedScrollViewDemo-Info.plist"; 279 | PRODUCT_NAME = "$(TARGET_NAME)"; 280 | VALIDATE_PRODUCT = YES; 281 | WRAPPER_EXTENSION = app; 282 | }; 283 | name = Release; 284 | }; 285 | /* End XCBuildConfiguration section */ 286 | 287 | /* Begin XCConfigurationList section */ 288 | B0CFE636136C70E700AFA05C /* Build configuration list for PBXProject "GCPagedScrollViewDemo" */ = { 289 | isa = XCConfigurationList; 290 | buildConfigurations = ( 291 | B0CFE65B136C70E800AFA05C /* Debug */, 292 | B0CFE65C136C70E800AFA05C /* Release */, 293 | ); 294 | defaultConfigurationIsVisible = 0; 295 | defaultConfigurationName = Release; 296 | }; 297 | B0CFE65D136C70E800AFA05C /* Build configuration list for PBXNativeTarget "GCPagedScrollViewDemo" */ = { 298 | isa = XCConfigurationList; 299 | buildConfigurations = ( 300 | B0CFE65E136C70E800AFA05C /* Debug */, 301 | B0CFE65F136C70E800AFA05C /* Release */, 302 | ); 303 | defaultConfigurationIsVisible = 0; 304 | defaultConfigurationName = Release; 305 | }; 306 | /* End XCConfigurationList section */ 307 | }; 308 | rootObject = B0CFE633136C70E700AFA05C /* Project object */; 309 | } 310 | -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo/GCPagedScrollViewDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.guillaumecampagna.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo/GCPagedScrollViewDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GCPagedScrollViewDemo' target in the 'GCPagedScrollViewDemo' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo/GCPagedScrollViewDemoAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCPagedScrollViewDemoAppDelegate.h 3 | // GCPagedScrollViewDemo 4 | // 5 | // Created by Guillaume Campagna on 11-04-30. 6 | // Copyright 2011 LittleKiwi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class GCPagedScrollViewDemoViewController; 12 | 13 | @interface GCPagedScrollViewDemoAppDelegate : NSObject 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | @property (nonatomic, retain) IBOutlet GCPagedScrollViewDemoViewController *viewController; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo/GCPagedScrollViewDemoAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCPagedScrollViewDemoAppDelegate.m 3 | // GCPagedScrollViewDemo 4 | // 5 | // Created by Guillaume Campagna on 11-04-30. 6 | // Copyright 2011 LittleKiwi. All rights reserved. 7 | // 8 | 9 | #import "GCPagedScrollViewDemoAppDelegate.h" 10 | 11 | #import "GCPagedScrollViewDemoViewController.h" 12 | 13 | @implementation GCPagedScrollViewDemoAppDelegate 14 | 15 | 16 | @synthesize window=_window; 17 | 18 | @synthesize viewController=_viewController; 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 21 | { 22 | self.window.rootViewController = self.viewController; 23 | [self.window makeKeyAndVisible]; 24 | return YES; 25 | } 26 | 27 | - (void)dealloc 28 | { 29 | [_window release]; 30 | [_viewController release]; 31 | [super dealloc]; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo/GCPagedScrollViewDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCPagedScrollViewDemoViewController.h 3 | // GCPagedScrollViewDemo 4 | // 5 | // Created by Guillaume Campagna on 11-04-30. 6 | // Copyright 2011 LittleKiwi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GCPagedScrollViewDemoViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo/GCPagedScrollViewDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCPagedScrollViewDemoViewController.m 3 | // GCPagedScrollViewDemo 4 | // 5 | // Created by Guillaume Campagna on 11-04-30. 6 | // Copyright 2011 LittleKiwi. All rights reserved. 7 | // 8 | 9 | #import "GCPagedScrollViewDemoViewController.h" 10 | #import "GCPagedScrollView.h" 11 | 12 | @interface GCPagedScrollViewDemoViewController () 13 | 14 | @property (nonatomic, readonly) GCPagedScrollView* scrollView; 15 | 16 | - (UIView*) createViewAtIndex:(NSUInteger) index; 17 | 18 | @end 19 | 20 | @implementation GCPagedScrollViewDemoViewController 21 | 22 | #pragma mark - View lifecycle 23 | 24 | - (void)loadView { 25 | [super loadView]; 26 | 27 | GCPagedScrollView* scrollView = [[GCPagedScrollView alloc] initWithFrame:self.view.frame]; 28 | scrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); 29 | self.view = scrollView; 30 | [scrollView release]; 31 | } 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | 36 | self.scrollView.backgroundColor = [UIColor blackColor]; 37 | 38 | for (NSUInteger index = 0; index < 5; index ++) { 39 | //You add your content views here 40 | [self.scrollView addContentSubview:[self createViewAtIndex:index]]; 41 | } 42 | } 43 | 44 | #pragma mark - 45 | #pragma mark Getters 46 | 47 | - (GCPagedScrollView *)scrollView { 48 | return (GCPagedScrollView*) self.view; 49 | } 50 | 51 | #pragma mark - 52 | #pragma mark Helper methods 53 | 54 | - (UIView *)createViewAtIndex:(NSUInteger)index { 55 | UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width - 20, 56 | self.view.frame.size.height - 50)]; 57 | view.backgroundColor = [UIColor whiteColor]; 58 | UILabel* numberLabel = [[UILabel alloc] initWithFrame:view.bounds]; 59 | numberLabel.text = [NSString stringWithFormat:@"%d", index]; 60 | numberLabel.textAlignment = UITextAlignmentCenter; 61 | numberLabel.font = [UIFont boldSystemFontOfSize:50.0]; 62 | [view addSubview:numberLabel]; 63 | [numberLabel release]; 64 | 65 | return [view autorelease]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo/en.lproj/GCPagedScrollViewDemoViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 800 5 | 10C540 6 | 759 7 | 1038.25 8 | 458.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 77 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 274 43 | {320, 460} 44 | 45 | 46 | 3 47 | MC43NQA 48 | 49 | 2 50 | 51 | 52 | NO 53 | 54 | IBCocoaTouchFramework 55 | 56 | 57 | 58 | 59 | YES 60 | 61 | 62 | view 63 | 64 | 65 | 66 | 7 67 | 68 | 69 | 70 | 71 | YES 72 | 73 | 0 74 | 75 | 76 | 77 | 78 | 79 | -1 80 | 81 | 82 | File's Owner 83 | 84 | 85 | -2 86 | 87 | 88 | 89 | 90 | 6 91 | 92 | 93 | 94 | 95 | 96 | 97 | YES 98 | 99 | YES 100 | -1.CustomClassName 101 | -2.CustomClassName 102 | 6.IBEditorWindowLastContentRect 103 | 6.IBPluginDependency 104 | 105 | 106 | YES 107 | GCPagedScrollViewDemoViewController 108 | UIResponder 109 | {{239, 654}, {320, 480}} 110 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 111 | 112 | 113 | 114 | YES 115 | 116 | 117 | YES 118 | 119 | 120 | 121 | 122 | YES 123 | 124 | 125 | YES 126 | 127 | 128 | 129 | 7 130 | 131 | 132 | 133 | YES 134 | 135 | GCPagedScrollViewDemoViewController 136 | UIViewController 137 | 138 | IBProjectSource 139 | GCPagedScrollViewDemoViewController.h 140 | 141 | 142 | 143 | 144 | 0 145 | IBCocoaTouchFramework 146 | 147 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 148 | 149 | 150 | YES 151 | GCPagedScrollViewDemo.xcodeproj 152 | 3 153 | 77 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo/en.lproj/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1024 5 | 10D571 6 | 786 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 112 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBCocoaTouchFramework 42 | 43 | 44 | GCPagedScrollViewDemoViewController 45 | 46 | 47 | 1 48 | 49 | IBCocoaTouchFramework 50 | NO 51 | 52 | 53 | 54 | 292 55 | {320, 480} 56 | 57 | 1 58 | MSAxIDEAA 59 | 60 | NO 61 | NO 62 | 63 | IBCocoaTouchFramework 64 | YES 65 | 66 | 67 | 68 | 69 | YES 70 | 71 | 72 | delegate 73 | 74 | 75 | 76 | 4 77 | 78 | 79 | 80 | viewController 81 | 82 | 83 | 84 | 11 85 | 86 | 87 | 88 | window 89 | 90 | 91 | 92 | 14 93 | 94 | 95 | 96 | 97 | YES 98 | 99 | 0 100 | 101 | 102 | 103 | 104 | 105 | -1 106 | 107 | 108 | File's Owner 109 | 110 | 111 | 3 112 | 113 | 114 | GCPagedScrollViewDemo App Delegate 115 | 116 | 117 | -2 118 | 119 | 120 | 121 | 122 | 10 123 | 124 | 125 | 126 | 127 | 12 128 | 129 | 130 | 131 | 132 | 133 | 134 | YES 135 | 136 | YES 137 | -1.CustomClassName 138 | -2.CustomClassName 139 | 10.CustomClassName 140 | 10.IBEditorWindowLastContentRect 141 | 10.IBPluginDependency 142 | 12.IBEditorWindowLastContentRect 143 | 12.IBPluginDependency 144 | 3.CustomClassName 145 | 3.IBPluginDependency 146 | 147 | 148 | YES 149 | UIApplication 150 | UIResponder 151 | GCPagedScrollViewDemoViewController 152 | {{234, 376}, {320, 480}} 153 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 154 | {{525, 346}, {320, 480}} 155 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 156 | GCPagedScrollViewDemoAppDelegate 157 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 158 | 159 | 160 | 161 | YES 162 | 163 | 164 | YES 165 | 166 | 167 | 168 | 169 | YES 170 | 171 | 172 | YES 173 | 174 | 175 | 176 | 15 177 | 178 | 179 | 180 | YES 181 | 182 | UIWindow 183 | UIView 184 | 185 | IBUserSource 186 | 187 | 188 | 189 | 190 | GCPagedScrollViewDemoAppDelegate 191 | NSObject 192 | 193 | YES 194 | 195 | YES 196 | viewController 197 | window 198 | 199 | 200 | YES 201 | GCPagedScrollViewDemoViewController 202 | UIWindow 203 | 204 | 205 | 206 | YES 207 | 208 | YES 209 | viewController 210 | window 211 | 212 | 213 | YES 214 | 215 | viewController 216 | GCPagedScrollViewDemoViewController 217 | 218 | 219 | window 220 | UIWindow 221 | 222 | 223 | 224 | 225 | IBProjectSource 226 | GCPagedScrollViewDemoAppDelegate.h 227 | 228 | 229 | 230 | GCPagedScrollViewDemoAppDelegate 231 | NSObject 232 | 233 | IBUserSource 234 | 235 | 236 | 237 | 238 | GCPagedScrollViewDemoViewController 239 | UIViewController 240 | 241 | IBProjectSource 242 | GCPagedScrollViewDemoViewController.h 243 | 244 | 245 | 246 | 247 | YES 248 | 249 | NSObject 250 | 251 | IBFrameworkSource 252 | Foundation.framework/Headers/NSError.h 253 | 254 | 255 | 256 | NSObject 257 | 258 | IBFrameworkSource 259 | Foundation.framework/Headers/NSFileManager.h 260 | 261 | 262 | 263 | NSObject 264 | 265 | IBFrameworkSource 266 | Foundation.framework/Headers/NSKeyValueCoding.h 267 | 268 | 269 | 270 | NSObject 271 | 272 | IBFrameworkSource 273 | Foundation.framework/Headers/NSKeyValueObserving.h 274 | 275 | 276 | 277 | NSObject 278 | 279 | IBFrameworkSource 280 | Foundation.framework/Headers/NSKeyedArchiver.h 281 | 282 | 283 | 284 | NSObject 285 | 286 | IBFrameworkSource 287 | Foundation.framework/Headers/NSObject.h 288 | 289 | 290 | 291 | NSObject 292 | 293 | IBFrameworkSource 294 | Foundation.framework/Headers/NSRunLoop.h 295 | 296 | 297 | 298 | NSObject 299 | 300 | IBFrameworkSource 301 | Foundation.framework/Headers/NSThread.h 302 | 303 | 304 | 305 | NSObject 306 | 307 | IBFrameworkSource 308 | Foundation.framework/Headers/NSURL.h 309 | 310 | 311 | 312 | NSObject 313 | 314 | IBFrameworkSource 315 | Foundation.framework/Headers/NSURLConnection.h 316 | 317 | 318 | 319 | NSObject 320 | 321 | IBFrameworkSource 322 | UIKit.framework/Headers/UIAccessibility.h 323 | 324 | 325 | 326 | NSObject 327 | 328 | IBFrameworkSource 329 | UIKit.framework/Headers/UINibLoading.h 330 | 331 | 332 | 333 | NSObject 334 | 335 | IBFrameworkSource 336 | UIKit.framework/Headers/UIResponder.h 337 | 338 | 339 | 340 | UIApplication 341 | UIResponder 342 | 343 | IBFrameworkSource 344 | UIKit.framework/Headers/UIApplication.h 345 | 346 | 347 | 348 | UIResponder 349 | NSObject 350 | 351 | 352 | 353 | UISearchBar 354 | UIView 355 | 356 | IBFrameworkSource 357 | UIKit.framework/Headers/UISearchBar.h 358 | 359 | 360 | 361 | UISearchDisplayController 362 | NSObject 363 | 364 | IBFrameworkSource 365 | UIKit.framework/Headers/UISearchDisplayController.h 366 | 367 | 368 | 369 | UIView 370 | 371 | IBFrameworkSource 372 | UIKit.framework/Headers/UITextField.h 373 | 374 | 375 | 376 | UIView 377 | UIResponder 378 | 379 | IBFrameworkSource 380 | UIKit.framework/Headers/UIView.h 381 | 382 | 383 | 384 | UIViewController 385 | 386 | IBFrameworkSource 387 | UIKit.framework/Headers/UINavigationController.h 388 | 389 | 390 | 391 | UIViewController 392 | 393 | IBFrameworkSource 394 | UIKit.framework/Headers/UIPopoverController.h 395 | 396 | 397 | 398 | UIViewController 399 | 400 | IBFrameworkSource 401 | UIKit.framework/Headers/UISplitViewController.h 402 | 403 | 404 | 405 | UIViewController 406 | 407 | IBFrameworkSource 408 | UIKit.framework/Headers/UITabBarController.h 409 | 410 | 411 | 412 | UIViewController 413 | UIResponder 414 | 415 | IBFrameworkSource 416 | UIKit.framework/Headers/UIViewController.h 417 | 418 | 419 | 420 | UIWindow 421 | UIView 422 | 423 | IBFrameworkSource 424 | UIKit.framework/Headers/UIWindow.h 425 | 426 | 427 | 428 | 429 | 0 430 | IBCocoaTouchFramework 431 | 432 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 433 | 434 | 435 | 436 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 437 | 438 | 439 | YES 440 | GCPagedScrollViewDemo.xcodeproj 441 | 3 442 | 112 443 | 444 | 445 | -------------------------------------------------------------------------------- /Demo/GCPagedScrollViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GCPagedScrollViewDemo 4 | // 5 | // Created by Guillaume Campagna on 11-04-30. 6 | // Copyright 2011 LittleKiwi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /GCPagedScrollView/GCPagedScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GCPagedScrollView.h 3 | // GCLibrary 4 | // 5 | // Created by Guillaume Campagna on 10-11-10. 6 | // Copyright (c) 2010 LittleKiwi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //Simple UIScrollView subclass that automatically handle UIPageControl and paged content 12 | @interface GCPagedScrollView : UIScrollView 13 | 14 | @property (nonatomic, assign) NSUInteger page; //Zero based number of page 15 | 16 | - (void) setPage:(NSUInteger)page animated:(BOOL) animated; 17 | 18 | //Add or remove content view from the scrollview 19 | - (void) addContentSubview:(UIView*) view; 20 | - (void) addContentSubview:(UIView*) view atIndex:(NSUInteger) index; 21 | - (void) addContentSubviewsFromArray:(NSArray*) contentViews; 22 | 23 | - (void) removeContentSubview:(UIView*) view; 24 | - (void) removeContentSubviewAtIndex:(NSUInteger) index; 25 | - (void) removeAllContentSubviews; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /GCPagedScrollView/GCPagedScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // GCPagedScrollView.m 3 | // GCLibrary 4 | // 5 | // Created by Guillaume Campagna on 10-11-10. 6 | // Copyright (c) 2010 LittleKiwi. All rights reserved. 7 | // 8 | 9 | #import "GCPagedScrollView.h" 10 | #import 11 | 12 | NSString * const GCPagedScrollViewContentOffsetKey = @"contentOffset"; 13 | const CGFloat GCPagedScrollViewPageControlHeight = 36.0; 14 | 15 | @interface GCPagedScrollView () 16 | 17 | @property (nonatomic, readonly) NSMutableArray* views; 18 | @property (nonatomic, readonly) UIPageControl* pageControl; 19 | 20 | - (void) updateViewPositionAndPageControl; 21 | 22 | - (void) changePage:(UIPageControl*) aPageControl; 23 | 24 | @end 25 | 26 | @implementation GCPagedScrollView 27 | 28 | @synthesize views; 29 | @synthesize pageControl; 30 | 31 | #pragma mark - 32 | #pragma mark Subclass 33 | 34 | - (id)initWithFrame:(CGRect)frame { 35 | if ((self = [super initWithFrame:frame])) { 36 | self.pagingEnabled = YES; 37 | self.showsVerticalScrollIndicator = NO; 38 | self.showsHorizontalScrollIndicator = NO; 39 | self.scrollsToTop = NO; 40 | 41 | //Place page control 42 | CGRect frame = CGRectMake(self.contentOffset.x, 0, self.frame.size.width, GCPagedScrollViewPageControlHeight); 43 | UIPageControl* aPageControl = [[UIPageControl alloc] initWithFrame:frame]; 44 | [aPageControl addTarget:self action:@selector(changePage:) forControlEvents:UIControlEventValueChanged]; 45 | aPageControl.defersCurrentPageDisplay = YES; 46 | aPageControl.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin); 47 | [self addSubview:aPageControl]; 48 | pageControl = aPageControl; 49 | } 50 | return self; 51 | } 52 | 53 | - (void) setPagingEnabled:(BOOL) pagingEnabled { 54 | if (pagingEnabled) [super setPagingEnabled:pagingEnabled]; 55 | else { 56 | [NSException raise:@"Disabling pagingEnabled" format:@"Paging enabled should not be disabled in GCPagedScrollView"]; 57 | } 58 | } 59 | 60 | #pragma mark - 61 | #pragma mark Add/Remove content 62 | 63 | - (void) addContentSubview:(UIView *)view { 64 | [self addContentSubview:view atIndex:[self.views count]]; 65 | } 66 | 67 | - (void) addContentSubview:(UIView *)view atIndex:(NSUInteger)index { 68 | [self insertSubview:view atIndex:index]; 69 | [self.views insertObject:view atIndex:index]; 70 | [self updateViewPositionAndPageControl]; 71 | self.contentOffset = CGPointMake(0, - self.scrollIndicatorInsets.top); 72 | } 73 | 74 | - (void)addContentSubviewsFromArray:(NSArray *)contentViews { 75 | for (UIView* contentView in contentViews) { 76 | [self addContentSubview:contentView]; 77 | } 78 | } 79 | 80 | - (void) removeContentSubview:(UIView *)view { 81 | [view removeFromSuperview]; 82 | 83 | [self.views removeObject:view]; 84 | [self updateViewPositionAndPageControl]; 85 | } 86 | 87 | - (void)removeContentSubviewAtIndex:(NSUInteger)index { 88 | [self removeContentSubview:[self.views objectAtIndex:index]]; 89 | } 90 | 91 | - (void) removeAllContentSubviews { 92 | for (UIView* view in self.views) { 93 | [view removeFromSuperview]; 94 | } 95 | 96 | [self.views removeAllObjects]; 97 | [self updateViewPositionAndPageControl]; 98 | } 99 | 100 | #pragma mark - 101 | #pragma mark Layout 102 | 103 | - (void) updateViewPositionAndPageControl { 104 | [self.views enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 105 | UIView* view = (UIView*) obj; 106 | view.center = CGPointMake(self.frame.size.width * idx + self.frame.size.width / 2, 107 | (self.frame.size.height - GCPagedScrollViewPageControlHeight) / 2); 108 | }]; 109 | 110 | UIEdgeInsets inset = self.scrollIndicatorInsets; 111 | CGFloat heightInset = inset.top + inset.bottom; 112 | self.contentSize = CGSizeMake(self.frame.size.width * [self.views count], self.frame.size.height - heightInset); 113 | 114 | self.pageControl.numberOfPages = self.views.count; 115 | } 116 | 117 | - (void) layoutSubviews { 118 | [super layoutSubviews]; 119 | 120 | //Avoid that the pageControl move 121 | [CATransaction begin]; 122 | [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; 123 | 124 | CGRect frame = self.pageControl.frame; 125 | frame.origin.x = self.contentOffset.x; 126 | frame.origin.y = self.frame.size.height - GCPagedScrollViewPageControlHeight - self.scrollIndicatorInsets.bottom - self.scrollIndicatorInsets.top; 127 | frame.size.width = self.frame.size.width; 128 | self.pageControl.frame = frame; 129 | 130 | [CATransaction commit]; 131 | } 132 | 133 | #pragma mark - 134 | #pragma mark Getters/Setters 135 | 136 | - (void) setFrame:(CGRect) newFrame { 137 | [super setFrame:newFrame]; 138 | [self updateViewPositionAndPageControl]; 139 | } 140 | 141 | - (void) changePage:(UIPageControl*) aPageControl { 142 | [self setPage:aPageControl.currentPage animated:YES]; 143 | } 144 | 145 | - (void) setContentOffset:(CGPoint) new { 146 | new.y = -self.scrollIndicatorInsets.top; 147 | [super setContentOffset:new]; 148 | 149 | self.pageControl.currentPage = self.page; //Update the page number 150 | } 151 | 152 | - (NSMutableArray*) views { 153 | if (views == nil) { 154 | views = [[NSMutableArray alloc] initWithCapacity:1]; 155 | } 156 | return views; 157 | } 158 | 159 | - (NSUInteger) page { 160 | return (self.contentOffset.x + self.frame.size.width / 2) / self.frame.size.width; 161 | } 162 | 163 | - (void) setPage:(NSUInteger)page { 164 | [self setPage:page animated:NO]; 165 | } 166 | 167 | - (void) setPage:(NSUInteger)page animated:(BOOL) animated { 168 | [self setContentOffset:CGPointMake(page * self.frame.size.width, - self.scrollIndicatorInsets.top) animated:animated]; 169 | } 170 | 171 | #pragma mark - 172 | #pragma mark Dealloc 173 | 174 | - (void)dealloc { 175 | [views release]; 176 | [pageControl release]; 177 | 178 | [super dealloc]; 179 | } 180 | 181 | 182 | @end 183 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | This control is dual licensed: 2 | 3 | You can use it for free under the MIT licence below or, if you require non-attribution you can purchase the commercial licence available at http://www.cocoacontrols.com/authors/gcamp 4 | 5 | --- 6 | 7 | Copyright (c) 2011 Guillaume Campagna 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | h1. GCPagedScrollView 2 | 3 | Simple @UIScrollView@ subclass that automatically handle @UIPageControl@ and paged content. 4 | 5 | You can have a paged @UIScrollView@ with @UIPageControl@ in almost no time. 6 | 7 | !http://littlekiwi.co.cc/GithubImages/GCPagedScrollView.png! 8 | 9 | h2. Usage 10 | 11 | (See the demo project included) 12 | 13 | You simply allocate the scroll view like you would normally, but instead of adding subviews directly, you add _content_ subviews with one of these methods. 14 | 15 |
16 | - (void) addContentSubview:(UIView*) view;
17 | - (void) addContentSubview:(UIView*) view atIndex:(NSUInteger) index;
18 | - (void) addContentSubviewsFromArray:(NSArray*) contentViews;
19 | 
20 | 21 | The views will be placed and managed automatically. 22 | 23 | You can remove content views with these methods. 24 | 25 |
26 | - (void) removeContentSubview:(UIView*) view;
27 | - (void) removeContentSubviewAtIndex:(NSUInteger) index;
28 | - (void) removeAllContentSubviews;
29 | 
30 | --------------------------------------------------------------------------------