Skip to content
Browse files

Updated to ARC and iOS 5.

  • Loading branch information...
1 parent a91a7be commit 4ee60acbf321a8bde1b9b85c846f7ab9622fb565 @hollance committed
View
148 Paging.xcodeproj/project.pbxproj → Demo.xcodeproj/project.pbxproj
@@ -10,31 +10,33 @@
7B0F4C981363017C00DE4938 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B0F4C971363017C00DE4938 /* UIKit.framework */; };
7B0F4C9A1363017C00DE4938 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B0F4C991363017C00DE4938 /* Foundation.framework */; };
7B0F4C9C1363017C00DE4938 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B0F4C9B1363017C00DE4938 /* CoreGraphics.framework */; };
- 7B5F044B136302F3006782F8 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7B5F0439136302F3006782F8 /* MainWindow.xib */; };
- 7B5F044C136302F3006782F8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B5F043C136302F3006782F8 /* AppDelegate.m */; };
- 7B5F044D136302F3006782F8 /* AppViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B5F043E136302F3006782F8 /* AppViewController.m */; };
- 7B5F044E136302F3006782F8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B5F043F136302F3006782F8 /* main.m */; };
- 7B94AC4C136BF9900079ECCB /* PageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B94AC4B136BF9900079ECCB /* PageView.m */; };
- 7BC2ED65136C3A4100A9D610 /* MHPagingScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC2ED64136C3A4100A9D610 /* MHPagingScrollView.m */; };
+ 7B109B201684D7F8008D78E0 /* DemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B109B141684D7F8008D78E0 /* DemoAppDelegate.m */; };
+ 7B109B211684D7F8008D78E0 /* DemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B109B161684D7F8008D78E0 /* DemoViewController.m */; };
+ 7B109B231684D7F8008D78E0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B109B181684D7F8008D78E0 /* main.m */; };
+ 7B109B251684D7F8008D78E0 /* PageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B109B1B1684D7F8008D78E0 /* PageView.m */; };
+ 7B109B261684D7F8008D78E0 /* MHPagingScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B109B1F1684D7F8008D78E0 /* MHPagingScrollView.m */; };
+ 7B109B291684D8A2008D78E0 /* DemoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7B109B281684D8A2008D78E0 /* DemoViewController.xib */; };
+ 7B109B321684DD17008D78E0 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7B109B311684DD17008D78E0 /* Default-568h@2x.png */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
- 7B0F4C931363017C00DE4938 /* Paging.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Paging.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7B0F4C931363017C00DE4938 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
7B0F4C971363017C00DE4938 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
7B0F4C991363017C00DE4938 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
7B0F4C9B1363017C00DE4938 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
- 7B5F0438136302F3006782F8 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
- 7B5F0439136302F3006782F8 /* MainWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
- 7B5F043B136302F3006782F8 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
- 7B5F043C136302F3006782F8 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
- 7B5F043D136302F3006782F8 /* AppViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppViewController.h; sourceTree = "<group>"; };
- 7B5F043E136302F3006782F8 /* AppViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppViewController.m; sourceTree = "<group>"; };
- 7B5F043F136302F3006782F8 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- 7B5F0440136302F3006782F8 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
- 7B94AC4A136BF9900079ECCB /* PageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageView.h; sourceTree = "<group>"; };
- 7B94AC4B136BF9900079ECCB /* PageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PageView.m; sourceTree = "<group>"; };
- 7BC2ED63136C3A4100A9D610 /* MHPagingScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MHPagingScrollView.h; sourceTree = "<group>"; };
- 7BC2ED64136C3A4100A9D610 /* MHPagingScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MHPagingScrollView.m; sourceTree = "<group>"; };
+ 7B109B131684D7F8008D78E0 /* DemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoAppDelegate.h; sourceTree = "<group>"; };
+ 7B109B141684D7F8008D78E0 /* DemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoAppDelegate.m; sourceTree = "<group>"; };
+ 7B109B151684D7F8008D78E0 /* DemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoViewController.h; sourceTree = "<group>"; };
+ 7B109B161684D7F8008D78E0 /* DemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoViewController.m; sourceTree = "<group>"; };
+ 7B109B171684D7F8008D78E0 /* Demo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Demo-Info.plist"; sourceTree = "<group>"; };
+ 7B109B181684D7F8008D78E0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 7B109B1A1684D7F8008D78E0 /* PageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageView.h; sourceTree = "<group>"; };
+ 7B109B1B1684D7F8008D78E0 /* PageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PageView.m; sourceTree = "<group>"; };
+ 7B109B1C1684D7F8008D78E0 /* Demo-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Demo-Prefix.pch"; sourceTree = "<group>"; };
+ 7B109B1E1684D7F8008D78E0 /* MHPagingScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MHPagingScrollView.h; sourceTree = "<group>"; };
+ 7B109B1F1684D7F8008D78E0 /* MHPagingScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MHPagingScrollView.m; sourceTree = "<group>"; };
+ 7B109B281684D8A2008D78E0 /* DemoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DemoViewController.xib; sourceTree = "<group>"; };
+ 7B109B311684DD17008D78E0 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -54,8 +56,8 @@
7B0F4C881363017C00DE4938 = {
isa = PBXGroup;
children = (
- 7B5F043A136302F3006782F8 /* Sources */,
- 7B5F0437136302F3006782F8 /* Resources */,
+ 7B109B1D1684D7F8008D78E0 /* MHPagingScrollView */,
+ 7B109B121684D7F8008D78E0 /* Demo */,
7B0F4C961363017C00DE4938 /* Frameworks */,
7B0F4C941363017C00DE4938 /* Products */,
);
@@ -64,7 +66,7 @@
7B0F4C941363017C00DE4938 /* Products */ = {
isa = PBXGroup;
children = (
- 7B0F4C931363017C00DE4938 /* Paging.app */,
+ 7B0F4C931363017C00DE4938 /* Demo.app */,
);
name = Products;
sourceTree = "<group>";
@@ -79,38 +81,47 @@
name = Frameworks;
sourceTree = "<group>";
};
- 7B5F0437136302F3006782F8 /* Resources */ = {
+ 7B109B121684D7F8008D78E0 /* Demo */ = {
isa = PBXGroup;
children = (
- 7B5F0438136302F3006782F8 /* Info.plist */,
- 7B5F0439136302F3006782F8 /* MainWindow.xib */,
+ 7B109B131684D7F8008D78E0 /* DemoAppDelegate.h */,
+ 7B109B141684D7F8008D78E0 /* DemoAppDelegate.m */,
+ 7B109B151684D7F8008D78E0 /* DemoViewController.h */,
+ 7B109B161684D7F8008D78E0 /* DemoViewController.m */,
+ 7B109B281684D8A2008D78E0 /* DemoViewController.xib */,
+ 7B109B1A1684D7F8008D78E0 /* PageView.h */,
+ 7B109B1B1684D7F8008D78E0 /* PageView.m */,
+ 7B109B271684D7FF008D78E0 /* Supporting Files */,
);
- path = Resources;
+ path = Demo;
sourceTree = "<group>";
};
- 7B5F043A136302F3006782F8 /* Sources */ = {
+ 7B109B1D1684D7F8008D78E0 /* MHPagingScrollView */ = {
isa = PBXGroup;
children = (
- 7B5F043B136302F3006782F8 /* AppDelegate.h */,
- 7B5F043C136302F3006782F8 /* AppDelegate.m */,
- 7B5F043D136302F3006782F8 /* AppViewController.h */,
- 7B5F043E136302F3006782F8 /* AppViewController.m */,
- 7B5F043F136302F3006782F8 /* main.m */,
- 7B5F0440136302F3006782F8 /* Prefix.pch */,
- 7B94AC4A136BF9900079ECCB /* PageView.h */,
- 7B94AC4B136BF9900079ECCB /* PageView.m */,
- 7BC2ED63136C3A4100A9D610 /* MHPagingScrollView.h */,
- 7BC2ED64136C3A4100A9D610 /* MHPagingScrollView.m */,
+ 7B109B1E1684D7F8008D78E0 /* MHPagingScrollView.h */,
+ 7B109B1F1684D7F8008D78E0 /* MHPagingScrollView.m */,
);
- path = Sources;
+ path = MHPagingScrollView;
+ sourceTree = "<group>";
+ };
+ 7B109B271684D7FF008D78E0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 7B109B311684DD17008D78E0 /* Default-568h@2x.png */,
+ 7B109B171684D7F8008D78E0 /* Demo-Info.plist */,
+ 7B109B1C1684D7F8008D78E0 /* Demo-Prefix.pch */,
+ 7B109B181684D7F8008D78E0 /* main.m */,
+ );
+ name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
- 7B0F4C921363017C00DE4938 /* Paging */ = {
+ 7B0F4C921363017C00DE4938 /* Demo */ = {
isa = PBXNativeTarget;
- buildConfigurationList = 7B0F4CB41363017C00DE4938 /* Build configuration list for PBXNativeTarget "Paging" */;
+ buildConfigurationList = 7B0F4CB41363017C00DE4938 /* Build configuration list for PBXNativeTarget "Demo" */;
buildPhases = (
7B0F4C8F1363017C00DE4938 /* Sources */,
7B0F4C901363017C00DE4938 /* Frameworks */,
@@ -120,9 +131,9 @@
);
dependencies = (
);
- name = Paging;
+ name = Demo;
productName = App;
- productReference = 7B0F4C931363017C00DE4938 /* Paging.app */;
+ productReference = 7B0F4C931363017C00DE4938 /* Demo.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
@@ -134,7 +145,7 @@
LastUpgradeCheck = 0420;
ORGANIZATIONNAME = Hollance;
};
- buildConfigurationList = 7B0F4C8D1363017C00DE4938 /* Build configuration list for PBXProject "Paging" */;
+ buildConfigurationList = 7B0F4C8D1363017C00DE4938 /* Build configuration list for PBXProject "Demo" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@@ -146,7 +157,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
- 7B0F4C921363017C00DE4938 /* Paging */,
+ 7B0F4C921363017C00DE4938 /* Demo */,
);
};
/* End PBXProject section */
@@ -156,7 +167,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 7B5F044B136302F3006782F8 /* MainWindow.xib in Resources */,
+ 7B109B291684D8A2008D78E0 /* DemoViewController.xib in Resources */,
+ 7B109B321684DD17008D78E0 /* Default-568h@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -167,11 +179,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 7B5F044C136302F3006782F8 /* AppDelegate.m in Sources */,
- 7B5F044D136302F3006782F8 /* AppViewController.m in Sources */,
- 7B5F044E136302F3006782F8 /* main.m in Sources */,
- 7B94AC4C136BF9900079ECCB /* PageView.m in Sources */,
- 7BC2ED65136C3A4100A9D610 /* MHPagingScrollView.m in Sources */,
+ 7B109B201684D7F8008D78E0 /* DemoAppDelegate.m in Sources */,
+ 7B109B211684D7F8008D78E0 /* DemoViewController.m in Sources */,
+ 7B109B231684D7F8008D78E0 /* main.m in Sources */,
+ 7B109B251684D7F8008D78E0 /* PageView.m in Sources */,
+ 7B109B261684D7F8008D78E0 /* MHPagingScrollView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -189,7 +201,7 @@
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
SDKROOT = iphoneos;
};
name = Debug;
@@ -202,7 +214,7 @@
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
};
@@ -212,15 +224,19 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = Sources/Prefix.pch;
- INFOPLIST_FILE = Resources/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 3.0;
- PRODUCT_NAME = "$(TARGET_NAME)";
+ GCC_PREFIX_HEADER = "Demo/Demo-Prefix.pch";
+ INFOPLIST_FILE = "Demo/Demo-Info.plist";
+ PRODUCT_NAME = Demo;
RUN_CLANG_STATIC_ANALYZER = YES;
- WARNING_CFLAGS = "-Wall";
+ WARNING_CFLAGS = (
+ "-Wall",
+ "-Wextra",
+ "-Wno-unused-parameter",
+ );
WRAPPER_EXTENSION = app;
};
name = Debug;
@@ -229,15 +245,19 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = Sources/Prefix.pch;
- INFOPLIST_FILE = Resources/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 3.0;
- PRODUCT_NAME = "$(TARGET_NAME)";
+ GCC_PREFIX_HEADER = "Demo/Demo-Prefix.pch";
+ INFOPLIST_FILE = "Demo/Demo-Info.plist";
+ PRODUCT_NAME = Demo;
RUN_CLANG_STATIC_ANALYZER = YES;
VALIDATE_PRODUCT = YES;
- WARNING_CFLAGS = "-Wall";
+ WARNING_CFLAGS = (
+ "-Wall",
+ "-Wextra",
+ "-Wno-unused-parameter",
+ );
WRAPPER_EXTENSION = app;
};
name = Release;
@@ -245,7 +265,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- 7B0F4C8D1363017C00DE4938 /* Build configuration list for PBXProject "Paging" */ = {
+ 7B0F4C8D1363017C00DE4938 /* Build configuration list for PBXProject "Demo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7B0F4CB21363017C00DE4938 /* Debug */,
@@ -254,7 +274,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- 7B0F4CB41363017C00DE4938 /* Build configuration list for PBXNativeTarget "Paging" */ = {
+ 7B0F4CB41363017C00DE4938 /* Build configuration list for PBXNativeTarget "Demo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7B0F4CB51363017C00DE4938 /* Debug */,
View
BIN Demo/Default-568h@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 Resources/Info.plist → Demo/Demo-Info.plist
@@ -35,13 +35,13 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
- <key>NSMainNibFile</key>
- <string>MainWindow</string>
<key>UIPrerenderedIcon</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
View
4 Sources/Prefix.pch → Demo/Demo-Prefix.pch
@@ -1,8 +1,8 @@
#import <Availability.h>
-#ifndef __IPHONE_3_0
- #warning "This project uses features only available in iPhone SDK 3.0 and later."
+#ifndef __IPHONE_5_0
+ #warning "This project uses features only available in iPhone SDK 5.0 and later."
#endif
#ifdef __OBJC__
View
9 Demo/DemoAppDelegate.h
@@ -0,0 +1,9 @@
+
+@class DemoViewController;
+
+@interface DemoAppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (nonatomic, strong) UIWindow *window;
+@property (nonatomic, strong) DemoViewController *viewController;
+
+@end
View
16 Demo/DemoAppDelegate.m
@@ -0,0 +1,16 @@
+
+#import "DemoAppDelegate.h"
+#import "DemoViewController.h"
+
+@implementation DemoAppDelegate
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ self.viewController = [[DemoViewController alloc] initWithNibName:@"DemoViewController" bundle:nil];
+ self.window.rootViewController = self.viewController;
+ [self.window makeKeyAndVisible];
+ return YES;
+}
+
+@end
View
11 Demo/DemoViewController.h
@@ -0,0 +1,11 @@
+
+#import "MHPagingScrollView.h"
+
+@interface DemoViewController : UIViewController <MHPagingScrollViewDelegate, UIScrollViewDelegate>
+
+@property (nonatomic, weak) IBOutlet MHPagingScrollView *pagingScrollView;
+@property (nonatomic, weak) IBOutlet UIPageControl *pageControl;
+
+- (IBAction)pageTurn;
+
+@end
View
87 Demo/DemoViewController.m
@@ -0,0 +1,87 @@
+
+#import "DemoViewController.h"
+#import "PageView.h"
+
+@implementation DemoViewController
+{
+ NSUInteger _numPages;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ _numPages = 2;
+
+ self.pagingScrollView.previewInsets = UIEdgeInsetsMake(0.0f, 50.0f, 0.0f, 50.0f);
+ [self.pagingScrollView reloadPages];
+
+ self.pageControl.currentPage = 0;
+ self.pageControl.numberOfPages = _numPages;
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [self.pagingScrollView didReceiveMemoryWarning];
+}
+
+#pragma mark - Actions
+
+- (IBAction)pageTurn
+{
+ [self.pagingScrollView selectPageAtIndex:self.pageControl.currentPage animated:YES];
+}
+
+#pragma mark - View Controller Rotation
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
+{
+ return YES;
+}
+
+- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
+{
+ [self.pagingScrollView beforeRotation];
+}
+
+- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
+{
+ [self.pagingScrollView afterRotation];
+}
+
+#pragma mark - UIScrollViewDelegate
+
+- (void)scrollViewDidScroll:(UIScrollView *)theScrollView
+{
+ self.pageControl.currentPage = [self.pagingScrollView indexOfSelectedPage];
+ [self.pagingScrollView scrollViewDidScroll];
+}
+
+- (void)scrollViewDidEndDecelerating:(UIScrollView *)theScrollView
+{
+ if ([self.pagingScrollView indexOfSelectedPage] == _numPages - 1)
+ {
+ _numPages++;
+ [self.pagingScrollView reloadPages];
+ self.pageControl.numberOfPages = _numPages;
+ }
+}
+
+#pragma mark - MHPagingScrollViewDelegate
+
+- (NSUInteger)numberOfPagesInPagingScrollView:(MHPagingScrollView *)pagingScrollView
+{
+ return _numPages;
+}
+
+- (UIView *)pagingScrollView:(MHPagingScrollView *)thePagingScrollView pageForIndex:(NSUInteger)index
+{
+ PageView *pageView = (PageView *)[thePagingScrollView dequeueReusablePage];
+ if (pageView == nil)
+ pageView = [[PageView alloc] init];
+
+ [pageView setPageIndex:index];
+ return pageView;
+}
+
+@end
View
279 Demo/DemoViewController.xib
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
+ <data>
+ <int key="IBDocument.SystemTarget">1536</int>
+ <string key="IBDocument.SystemVersion">12C60</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2844</string>
+ <string key="IBDocument.AppKitVersion">1187.34</string>
+ <string key="IBDocument.HIToolboxVersion">625.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">1930</string>
+ </object>
+ <array key="IBDocument.IntegratedClassDependencies">
+ <string>IBProxyObject</string>
+ <string>IBUIPageControl</string>
+ <string>IBUIScrollView</string>
+ <string>IBUIView</string>
+ </array>
+ <array key="IBDocument.PluginDependencies">
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </array>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIView" id="548297266">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="IBUIPageControl" id="651046659">
+ <reference key="NSNextResponder" ref="548297266"/>
+ <int key="NSvFlags">1290</int>
+ <object class="NSPSMatrix" key="NSFrameMatrix"/>
+ <string key="NSFrame">{{0, 424}, {320, 36}}</string>
+ <reference key="NSSuperview" ref="548297266"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <int key="IBUINumberOfPages">3</int>
+ </object>
+ <object class="IBUIView" id="994811018">
+ <reference key="NSNextResponder" ref="548297266"/>
+ <int key="NSvFlags">274</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="IBUIScrollView" id="251902864">
+ <reference key="NSNextResponder" ref="994811018"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrame">{{50, 0}, {220, 416}}</string>
+ <reference key="NSSuperview" ref="994811018"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="651046659"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MCAwAA</bytes>
+ </object>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBUIPagingEnabled">YES</bool>
+ <bool key="IBUIShowsHorizontalScrollIndicator">NO</bool>
+ <bool key="IBUIShowsVerticalScrollIndicator">NO</bool>
+ </object>
+ </array>
+ <string key="NSFrameSize">{320, 416}</string>
+ <reference key="NSSuperview" ref="548297266"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="251902864"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4yNTA5ODAzOTIyIDAuMjUwOTgwMzkyMiAwLjI1MDk4MDM5MjIAA</bytes>
+ </object>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </array>
+ <string key="NSFrame">{{0, 20}, {320, 460}}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="994811018"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ </object>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </array>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <array class="NSMutableArray" key="connectionRecords">
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">pageControl</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="651046659"/>
+ </object>
+ <int key="connectionID">18</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">pagingScrollView</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="251902864"/>
+ </object>
+ <int key="connectionID">19</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="548297266"/>
+ </object>
+ <int key="connectionID">23</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">pageTurn</string>
+ <reference key="source" ref="651046659"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">13</int>
+ </object>
+ <int key="connectionID">22</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="251902864"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">20</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">pagingDelegate</string>
+ <reference key="source" ref="251902864"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">21</int>
+ </object>
+ </array>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <array key="orderedObjects">
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <array key="object" id="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3</int>
+ <reference key="object" ref="548297266"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="994811018"/>
+ <reference ref="651046659"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">View</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">4</int>
+ <reference key="object" ref="994811018"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="251902864"/>
+ </array>
+ <reference key="parent" ref="548297266"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="651046659"/>
+ <reference key="parent" ref="548297266"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6</int>
+ <reference key="object" ref="251902864"/>
+ <reference key="parent" ref="994811018"/>
+ </object>
+ </array>
+ </object>
+ <dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-1.CustomClassName">DemoViewController</string>
+ <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="-2.CustomClassName">UIResponder</string>
+ <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="3.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="6.CustomClassName">MHPagingScrollView</string>
+ <string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
+ <nil key="activeLocalization"/>
+ <dictionary class="NSMutableDictionary" key="localizations"/>
+ <nil key="sourceID"/>
+ <int key="maxID">23</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <array class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <object class="IBPartialClassDescription">
+ <string key="className">DemoViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">pageTurn</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <string key="NS.key.0">pageTurn</string>
+ <object class="IBActionInfo" key="NS.object.0">
+ <string key="name">pageTurn</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ <dictionary class="NSMutableDictionary" key="outlets">
+ <string key="pageControl">UIPageControl</string>
+ <string key="pagingScrollView">MHPagingScrollView</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <object class="IBToOneOutletInfo" key="pageControl">
+ <string key="name">pageControl</string>
+ <string key="candidateClassName">UIPageControl</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="pagingScrollView">
+ <string key="name">pagingScrollView</string>
+ <string key="candidateClassName">MHPagingScrollView</string>
+ </object>
+ </dictionary>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/DemoViewController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">MHPagingScrollView</string>
+ <string key="superclassName">UIScrollView</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">pagingDelegate</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">pagingDelegate</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">pagingDelegate</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/MHPagingScrollView.h</string>
+ </object>
+ </object>
+ </array>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">1930</string>
+ </data>
+</archive>
View
0 Sources/PageView.h → Demo/PageView.h
File renamed without changes.
View
0 Sources/PageView.m → Demo/PageView.m
File renamed without changes.
View
10 Demo/main.m
@@ -0,0 +1,10 @@
+
+#import "DemoAppDelegate.h"
+
+int main(int argc, char *argv[])
+{
+ @autoreleasepool
+ {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([DemoAppDelegate class]));
+ }
+}
View
1,630 Doxyfile
0 additions, 1,630 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
41 Sources/MHPagingScrollView.h → MHPagingScrollView/MHPagingScrollView.h
@@ -1,28 +1,25 @@
-/*!
- * \file MHPagingScrollView.h
- */
@class MHPagingScrollView;
-/*!
+/*
* Delegate protocol for MHPagingScrollView.
*/
@protocol MHPagingScrollViewDelegate <NSObject>
-/*!
+/*
* Asks the delegate to return the number of pages.
*/
-- (NSInteger)numberOfPagesInPagingScrollView:(MHPagingScrollView *)pagingScrollView;
+- (NSUInteger)numberOfPagesInPagingScrollView:(MHPagingScrollView *)pagingScrollView;
-/*!
+/*
* Asks the delegate for a page to insert. The delegate should ask for a
* reusable view using dequeueReusablePageView.
*/
-- (UIView *)pagingScrollView:(MHPagingScrollView *)pagingScrollView pageForIndex:(NSInteger)index;
+- (UIView *)pagingScrollView:(MHPagingScrollView *)pagingScrollView pageForIndex:(NSUInteger)index;
@end
-/*!
+/*
* A paging scroll view that employs a reusable page mechanism like UITableView.
*
* MHPagingScrollView allows you to show partial previews of the pages to the
@@ -33,50 +30,50 @@
*/
@interface MHPagingScrollView : UIScrollView
-/*! The delegate for paging events. */
-@property (nonatomic, assign) IBOutlet id <MHPagingScrollViewDelegate> pagingDelegate;
+/* The delegate for paging events. */
+@property (nonatomic, weak) IBOutlet id <MHPagingScrollViewDelegate> pagingDelegate;
-/*! The width of the preview pages. */
+/* The width of the preview pages. */
@property (nonatomic, assign) UIEdgeInsets previewInsets;
-/*!
+/*
* Makes the page at the requested index visible.
*/
-- (void)selectPageAtIndex:(NSInteger)index animated:(BOOL)animated;
+- (void)selectPageAtIndex:(NSUInteger)index animated:(BOOL)animated;
-/*!
+/*
* Returns the index of the page that is currently visible.
*/
-- (NSInteger)indexOfSelectedPage;
+- (NSUInteger)indexOfSelectedPage;
-/*!
+/*
* Returns a reusable UIView object.
*/
- (UIView *)dequeueReusablePage;
-/*!
+/*
* Reloads the pages. Call this method when the number of pages has changed.
*/
- (void)reloadPages;
-/*!
+/*
* Call this from your view controller's UIScrollViewDelegate.
*/
- (void)scrollViewDidScroll;
-/*!
+/*
* Call this from your view controller's willRotateToInterfaceOrientation if
* you want to support autorotation.
*/
- (void)beforeRotation;
-/*!
+/*
* Call this from your view controller's willAnimateRotationToInterfaceOrientation
* if you want to support autorotation.
*/
- (void)afterRotation;
-/*!
+/*
* Call this from your view controller's didReceiveMemoryWarning.
*/
- (void)didReceiveMemoryWarning;
View
93 Sources/MHPagingScrollView.m → MHPagingScrollView/MHPagingScrollView.m
@@ -3,39 +3,27 @@
@interface MHPage : NSObject
-@property (nonatomic, retain) UIView *view;
-@property (nonatomic, assign) NSInteger index;
+@property (nonatomic, strong) UIView *view;
+@property (nonatomic, assign) NSUInteger index;
@end
@implementation MHPage
-@synthesize view;
-@synthesize index;
-
-- (void)dealloc
-{
- [view release];
- [super dealloc];
-}
-
@end
@implementation MHPagingScrollView
{
- NSMutableSet *recycledPages;
- NSMutableSet *visiblePages;
- int firstVisiblePageIndexBeforeRotation; // for autorotation
- CGFloat percentScrolledIntoFirstVisiblePage;
+ NSMutableSet *_recycledPages;
+ NSMutableSet *_visiblePages;
+ NSUInteger _firstVisiblePageIndexBeforeRotation; // for autorotation
+ CGFloat _percentScrolledIntoFirstVisiblePage;
}
-@synthesize previewInsets;
-@synthesize pagingDelegate;
-
- (void)commonInit
{
- recycledPages = [[NSMutableSet alloc] init];
- visiblePages = [[NSMutableSet alloc] init];
+ _recycledPages = [[NSMutableSet alloc] init];
+ _visiblePages = [[NSMutableSet alloc] init];
self.pagingEnabled = YES;
self.showsVerticalScrollIndicator = NO;
@@ -61,13 +49,6 @@ - (id)initWithCoder:(NSCoder *)aDecoder
return self;
}
-- (void)dealloc
-{
- [recycledPages release];
- [visiblePages release];
- [super dealloc];
-}
-
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
// This allows for touch handling outside of the scroll view's bounds.
@@ -75,15 +56,15 @@ - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
CGPoint parentLocation = [self convertPoint:point toView:self.superview];
CGRect responseRect = self.frame;
- responseRect.origin.x -= previewInsets.left;
- responseRect.origin.y -= previewInsets.top;
- responseRect.size.width += (previewInsets.left + previewInsets.right);
- responseRect.size.height += (previewInsets.top + previewInsets.bottom);
+ responseRect.origin.x -= _previewInsets.left;
+ responseRect.origin.y -= _previewInsets.top;
+ responseRect.size.width += (_previewInsets.left + _previewInsets.right);
+ responseRect.size.height += (_previewInsets.top + _previewInsets.bottom);
return CGRectContainsPoint(responseRect, parentLocation);
}
-- (void)selectPageAtIndex:(NSInteger)index animated:(BOOL)animated
+- (void)selectPageAtIndex:(NSUInteger)index animated:(BOOL)animated
{
if (animated)
{
@@ -98,16 +79,16 @@ - (void)selectPageAtIndex:(NSInteger)index animated:(BOOL)animated
[UIView commitAnimations];
}
-- (NSInteger)indexOfSelectedPage
+- (NSUInteger)indexOfSelectedPage
{
CGFloat width = self.bounds.size.width;
int currentPage = (self.contentOffset.x + width/2.0f) / width;
return currentPage;
}
-- (NSInteger)numberOfPages
+- (NSUInteger)numberOfPages
{
- return [pagingDelegate numberOfPagesInPagingScrollView:self];
+ return [_pagingDelegate numberOfPagesInPagingScrollView:self];
}
- (CGSize)contentSizeForPagingScrollView
@@ -118,7 +99,7 @@ - (CGSize)contentSizeForPagingScrollView
- (BOOL)isDisplayingPageForIndex:(NSUInteger)index
{
- for (MHPage *page in visiblePages)
+ for (MHPage *page in _visiblePages)
{
if (page.index == index)
return YES;
@@ -128,11 +109,11 @@ - (BOOL)isDisplayingPageForIndex:(NSUInteger)index
- (UIView *)dequeueReusablePage
{
- MHPage *page = [recycledPages anyObject];
+ MHPage *page = [_recycledPages anyObject];
if (page != nil)
{
- UIView *view = [[page.view retain] autorelease];
- [recycledPages removeObject:page];
+ UIView *view = page.view;
+ [_recycledPages removeObject:page];
return view;
}
return nil;
@@ -149,38 +130,38 @@ - (void)tilePages
{
CGRect visibleBounds = self.bounds;
CGFloat pageWidth = CGRectGetWidth(visibleBounds);
- visibleBounds.origin.x -= previewInsets.left;
- visibleBounds.size.width += (previewInsets.left + previewInsets.right);
+ visibleBounds.origin.x -= _previewInsets.left;
+ visibleBounds.size.width += (_previewInsets.left + _previewInsets.right);
int firstNeededPageIndex = floorf(CGRectGetMinX(visibleBounds) / pageWidth);
- int lastNeededPageIndex = floorf((CGRectGetMaxX(visibleBounds)-1) / pageWidth);
+ int lastNeededPageIndex = floorf((CGRectGetMaxX(visibleBounds) - 1.0f) / pageWidth);
firstNeededPageIndex = MAX(firstNeededPageIndex, 0);
- lastNeededPageIndex = MIN(lastNeededPageIndex, [self numberOfPages] - 1);
+ lastNeededPageIndex = MIN(lastNeededPageIndex, (int)[self numberOfPages] - 1);
- for (MHPage *page in visiblePages)
+ for (MHPage *page in _visiblePages)
{
- if (page.index < firstNeededPageIndex || page.index > lastNeededPageIndex)
+ if ((int)page.index < firstNeededPageIndex || (int)page.index > lastNeededPageIndex)
{
- [recycledPages addObject:page];
+ [_recycledPages addObject:page];
[page.view removeFromSuperview];
}
}
- [visiblePages minusSet:recycledPages];
+ [_visiblePages minusSet:_recycledPages];
for (int i = firstNeededPageIndex; i <= lastNeededPageIndex; ++i)
{
if (![self isDisplayingPageForIndex:i])
{
- UIView *pageView = [pagingDelegate pagingScrollView:self pageForIndex:i];
+ UIView *pageView = [_pagingDelegate pagingScrollView:self pageForIndex:i];
pageView.frame = [self frameForPageAtIndex:i];
+ pageView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
[self addSubview:pageView];
MHPage *page = [[MHPage alloc] init];
page.index = i;
page.view = pageView;
- [visiblePages addObject:page];
- [page release];
+ [_visiblePages addObject:page];
}
}
}
@@ -202,28 +183,28 @@ - (void)beforeRotation
CGFloat pageWidth = self.bounds.size.width;
if (offset >= 0)
- firstVisiblePageIndexBeforeRotation = floorf(offset / pageWidth);
+ _firstVisiblePageIndexBeforeRotation = floorf(offset / pageWidth);
else
- firstVisiblePageIndexBeforeRotation = 0;
+ _firstVisiblePageIndexBeforeRotation = 0;
- percentScrolledIntoFirstVisiblePage = offset / pageWidth - firstVisiblePageIndexBeforeRotation;
+ _percentScrolledIntoFirstVisiblePage = offset / pageWidth - _firstVisiblePageIndexBeforeRotation;
}
- (void)afterRotation
{
self.contentSize = [self contentSizeForPagingScrollView];
- for (MHPage *page in visiblePages)
+ for (MHPage *page in _visiblePages)
page.view.frame = [self frameForPageAtIndex:page.index];
CGFloat pageWidth = self.bounds.size.width;
- CGFloat newOffset = (firstVisiblePageIndexBeforeRotation + percentScrolledIntoFirstVisiblePage) * pageWidth;
+ CGFloat newOffset = (_firstVisiblePageIndexBeforeRotation + _percentScrolledIntoFirstVisiblePage) * pageWidth;
self.contentOffset = CGPointMake(newOffset, 0);
}
- (void)didReceiveMemoryWarning
{
- [recycledPages removeAllObjects];
+ [_recycledPages removeAllObjects];
}
@end
View
3 MakeDocs.sh
@@ -1,3 +0,0 @@
-#!/bin/sh
-/Applications/Doxygen.app/Contents/Resources/doxygen
-
View
5 README.md
@@ -0,0 +1,5 @@
+# MHPagingScrollView
+
+A `UIScrollView` subclass that shows previews of the pages on the left and right. It uses a delegate much in the way UITableView uses a data source.
+
+This is largely based on WWDC 2010 session 104 and the PhotoScroller sample, without the CATiledLayer pinch-to-zoom stuff.
View
3 README.txt
@@ -1,3 +0,0 @@
-A UIScrollView subclass that shows previews of the pages on the left and right. It uses a delegate much in the way UITableView uses a data source.
-
-This is largely based on WWDC 2010 session 104 and the PhotoScroller sample, without the CATiledLayer pinch-to-zoom stuff.
View
452 Resources/MainWindow.xib
@@ -1,452 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
- <data>
- <int key="IBDocument.SystemTarget">1280</int>
- <string key="IBDocument.SystemVersion">11C74</string>
- <string key="IBDocument.InterfaceBuilderVersion">1938</string>
- <string key="IBDocument.AppKitVersion">1138.23</string>
- <string key="IBDocument.HIToolboxVersion">567.00</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
- <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">933</string>
- </object>
- <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>IBProxyObject</string>
- <string>IBUIViewController</string>
- <string>IBUICustomObject</string>
- <string>IBUIWindow</string>
- <string>IBUIPageControl</string>
- <string>IBUIScrollView</string>
- <string>IBUIView</string>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
- <integer value="1" key="NS.object.0"/>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBProxyObject" id="841351856">
- <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- <object class="IBProxyObject" id="427554174">
- <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- <object class="IBUICustomObject" id="664661524">
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- <object class="IBUIViewController" id="943309135">
- <object class="IBUIView" key="IBUIView" id="361271949">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">274</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBUIPageControl" id="609289072">
- <reference key="NSNextResponder" ref="361271949"/>
- <int key="NSvFlags">1290</int>
- <object class="NSPSMatrix" key="NSFrameMatrix"/>
- <string key="NSFrame">{{0, 424}, {320, 36}}</string>
- <reference key="NSSuperview" ref="361271949"/>
- <reference key="NSWindow"/>
- <bool key="IBUIOpaque">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <int key="IBUIContentHorizontalAlignment">0</int>
- <int key="IBUIContentVerticalAlignment">0</int>
- <int key="IBUINumberOfPages">3</int>
- </object>
- <object class="IBUIView" id="108078305">
- <reference key="NSNextResponder" ref="361271949"/>
- <int key="NSvFlags">274</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBUIScrollView" id="663150079">
- <reference key="NSNextResponder" ref="108078305"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrame">{{50, 0}, {220, 416}}</string>
- <reference key="NSSuperview" ref="108078305"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="609289072"/>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MCAwAA</bytes>
- </object>
- <bool key="IBUIOpaque">NO</bool>
- <bool key="IBUIMultipleTouchEnabled">YES</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <bool key="IBUIPagingEnabled">YES</bool>
- <bool key="IBUIShowsHorizontalScrollIndicator">NO</bool>
- <bool key="IBUIShowsVerticalScrollIndicator">NO</bool>
- </object>
- </object>
- <string key="NSFrameSize">{320, 416}</string>
- <reference key="NSSuperview" ref="361271949"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="663150079"/>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MC4yNTA5ODAzOTIyIDAuMjUwOTgwMzkyMiAwLjI1MDk4MDM5MjIAA</bytes>
- </object>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- </object>
- <string key="NSFrame">{{0, 20}, {320, 460}}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="108078305"/>
- <object class="NSColor" key="IBUIBackgroundColor" id="880280134">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MAA</bytes>
- </object>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- </object>
- <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
- <object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
- <int key="IBUIInterfaceOrientation">1</int>
- <int key="interfaceOrientation">1</int>
- </object>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <bool key="IBUIHorizontal">NO</bool>
- </object>
- <object class="IBUIWindow" id="117978783">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">292</int>
- <string key="NSFrameSize">{320, 480}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
- <reference key="IBUIBackgroundColor" ref="880280134"/>
- <bool key="IBUIOpaque">NO</bool>
- <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
- <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <bool key="IBUIResizesToFullScreen">YES</bool>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="841351856"/>
- <reference key="destination" ref="664661524"/>
- </object>
- <int key="connectionID">4</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">viewController</string>
- <reference key="source" ref="664661524"/>
- <reference key="destination" ref="943309135"/>
- </object>
- <int key="connectionID">11</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="664661524"/>
- <reference key="destination" ref="117978783"/>
- </object>
- <int key="connectionID">14</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">pageControl</string>
- <reference key="source" ref="943309135"/>
- <reference key="destination" ref="609289072"/>
- </object>
- <int key="connectionID">20</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">pagingScrollView</string>
- <reference key="source" ref="943309135"/>
- <reference key="destination" ref="663150079"/>
- </object>
- <int key="connectionID">25</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchEventConnection" key="connection">
- <string key="label">pageTurn</string>
- <reference key="source" ref="609289072"/>
- <reference key="destination" ref="943309135"/>
- <int key="IBEventType">13</int>
- </object>
- <int key="connectionID">22</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="663150079"/>
- <reference key="destination" ref="943309135"/>
- </object>
- <int key="connectionID">21</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">pagingDelegate</string>
- <reference key="source" ref="663150079"/>
- <reference key="destination" ref="943309135"/>
- </object>
- <int key="connectionID">26</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <object class="NSArray" key="object" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="841351856"/>
- <reference key="parent" ref="0"/>
- <string key="objectName">File's Owner</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">3</int>
- <reference key="object" ref="664661524"/>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="427554174"/>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">10</int>
- <reference key="object" ref="943309135"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="361271949"/>
- </object>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">12</int>
- <reference key="object" ref="117978783"/>
- <reference key="parent" ref="0"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">16</int>
- <reference key="object" ref="361271949"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="609289072"/>
- <reference ref="108078305"/>
- </object>
- <reference key="parent" ref="943309135"/>
- <string key="objectName">View</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">17</int>
- <reference key="object" ref="609289072"/>
- <reference key="parent" ref="361271949"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">23</int>
- <reference key="object" ref="108078305"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="663150079"/>
- </object>
- <reference key="parent" ref="361271949"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">18</int>
- <reference key="object" ref="663150079"/>
- <reference key="parent" ref="108078305"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>-1.CustomClassName</string>
- <string>-1.IBPluginDependency</string>
- <string>-2.CustomClassName</string>
- <string>-2.IBPluginDependency</string>
- <string>10.CustomClassName</string>
- <string>10.IBPluginDependency</string>
- <string>12.IBPluginDependency</string>
- <string>16.IBPluginDependency</string>
- <string>17.IBPluginDependency</string>
- <string>18.CustomClassName</string>
- <string>18.IBPluginDependency</string>
- <string>23.IBPluginDependency</string>
- <string>3.CustomClassName</string>
- <string>3.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>UIApplication</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>UIResponder</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>AppViewController</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>MHPagingScrollView</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>AppDelegate</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <reference key="dict.values" ref="0"/>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference key="dict.sortedKeys" ref="0"/>
- <reference key="dict.values" ref="0"/>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">26</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">AppDelegate</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>viewController</string>
- <string>window</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>UIViewController</string>
- <string>UIWindow</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>viewController</string>
- <string>window</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">viewController</string>
- <string key="candidateClassName">UIViewController</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">window</string>
- <string key="candidateClassName">UIWindow</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/AppDelegate.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">AppViewController</string>
- <string key="superclassName">UIViewController</string>
- <object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">pageTurn</string>
- <string key="NS.object.0">id</string>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <string key="NS.key.0">pageTurn</string>
- <object class="IBActionInfo" key="NS.object.0">
- <string key="name">pageTurn</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>pageControl</string>
- <string>pagingScrollView</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>UIPageControl</string>
- <string>MHPagingScrollView</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>pageControl</string>
- <string>pagingScrollView</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBToOneOutletInfo">
- <string key="name">pageControl</string>
- <string key="candidateClassName">UIPageControl</string>
- </object>
- <object class="IBToOneOutletInfo">
- <string key="name">pagingScrollView</string>
- <string key="candidateClassName">MHPagingScrollView</string>
- </object>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/AppViewController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">MHPagingScrollView</string>
- <string key="superclassName">UIScrollView</string>
- <object class="NSMutableDictionary" key="outlets">
- <string key="NS.key.0">pagingDelegate</string>
- <string key="NS.object.0">id</string>
- </object>
- <object class="NSMutableDictionary" key="toOneOutletInfosByName">
- <string key="NS.key.0">pagingDelegate</string>
- <object class="IBToOneOutletInfo" key="NS.object.0">
- <string key="name">pagingDelegate</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">./Classes/MHPagingScrollView.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
- <real value="1280" key="NS.object.0"/>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
- <integer value="3100" key="NS.object.0"/>
- </object>
- <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">933</string>
- </data>
-</archive>
View
7 Sources/AppDelegate.h
@@ -1,7 +0,0 @@
-
-@interface AppDelegate : NSObject <UIApplicationDelegate>
-
-@property (nonatomic, retain) IBOutlet UIWindow *window;
-@property (nonatomic, retain) IBOutlet UIViewController *viewController;
-
-@end
View
22 Sources/AppDelegate.m
@@ -1,22 +0,0 @@
-
-#import "AppDelegate.h"
-
-@implementation AppDelegate
-
-@synthesize window, viewController;
-
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
-{
- [self.window addSubview:self.viewController.view];
- [self.window makeKeyAndVisible];
- return YES;
-}
-
-- (void)dealloc
-{
- [window release];
- [viewController release];
- [super dealloc];
-}
-
-@end
View
14 Sources/AppViewController.h
@@ -1,14 +0,0 @@
-
-#import "MHPagingScrollView.h"
-
-@interface AppViewController : UIViewController <MHPagingScrollViewDelegate, UIScrollViewDelegate>
-{
- int numPages;
-}
-
-@property (nonatomic, retain) IBOutlet MHPagingScrollView *pagingScrollView;
-@property (nonatomic, retain) IBOutlet UIPageControl *pageControl;
-
-- (IBAction)pageTurn;
-
-@end
View
104 Sources/AppViewController.m
@@ -1,104 +0,0 @@
-
-#import "AppViewController.h"
-#import "PageView.h"
-
-@implementation AppViewController
-
-@synthesize pagingScrollView, pageControl;
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
-
- numPages = 2;
-
- pagingScrollView.previewInsets = UIEdgeInsetsMake(0, 50, 0, 50);
- [pagingScrollView reloadPages];
-
- pageControl.currentPage = 0;
- pageControl.numberOfPages = numPages;
-}
-
-- (void)releaseObjects
-{
- [pagingScrollView release], pagingScrollView = nil;
- [pageControl release], pageControl = nil;
-}
-
-- (void)viewDidUnload
-{
- [super viewDidUnload];
- [self releaseObjects];
-}
-
-- (void)dealloc
-{
- [self releaseObjects];
- [super dealloc];
-}
-
-- (void)didReceiveMemoryWarning
-{
- [pagingScrollView didReceiveMemoryWarning];
-}
-
-#pragma mark - Actions
-
-- (IBAction)pageTurn
-{
- [pagingScrollView selectPageAtIndex:pageControl.currentPage animated:YES];
-}
-
-#pragma mark - View Controller Rotation
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
-{
- return YES;
-}
-
-- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
-{
- [pagingScrollView beforeRotation];
-}
-
-- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
-{
- [pagingScrollView afterRotation];
-}
-
-#pragma mark - UIScrollViewDelegate
-
-- (void)scrollViewDidScroll:(UIScrollView *)theScrollView
-{
- pageControl.currentPage = [pagingScrollView indexOfSelectedPage];
- [pagingScrollView scrollViewDidScroll];
-}
-
-- (void)scrollViewDidEndDecelerating:(UIScrollView *)theScrollView
-{
- if ([pagingScrollView indexOfSelectedPage] == numPages - 1)
- {
- numPages++;
- [pagingScrollView reloadPages];
- pageControl.numberOfPages = numPages;
- }
-}
-
-#pragma mark - MHPagingScrollViewDelegate
-
-- (NSInteger)numberOfPagesInPagingScrollView:(MHPagingScrollView *)pagingScrollView
-{
- return numPages;
-}
-
-- (UIView *)pagingScrollView:(MHPagingScrollView *)thePagingScrollView pageForIndex:(NSInteger)index
-{
- PageView *pageView = (PageView *)[thePagingScrollView dequeueReusablePage];
- if (pageView == nil)
- pageView = [[[PageView alloc] init] autorelease];
-
- [pageView setPageIndex:index];
- return pageView;
-}
-
-@end
View
8 Sources/main.m
@@ -1,8 +0,0 @@
-
-int main(int argc, char *argv[])
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- int retVal = UIApplicationMain(argc, argv, nil, nil);
- [pool release];
- return retVal;
-}

0 comments on commit 4ee60ac

Please sign in to comment.
Something went wrong with that request. Please try again.