├── ARTableViewPager ├── en.lproj │ └── InfoPlist.strings ├── main.m ├── ARTableViewPager-Prefix.pch └── ARTableViewPager-Info.plist ├── Example └── SimpleExample │ ├── SimpleExample │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── SimpleExample-Prefix.pch │ ├── SimpleExample-Info.plist │ ├── SimpleTableViewPagerViewController.h │ ├── main.m │ ├── AppDelegate.h │ ├── AppDelegate.m │ └── SimpleTableViewPagerViewController.m │ ├── Default-568h@2x.png │ └── SimpleExample.xcodeproj │ └── project.pbxproj ├── Screenshots ├── screenshot_1.png ├── screenshot_2.png └── screenshot_3.png ├── .ARTableViewPager.podspec.swp ├── .gitignore ├── ARTableViewPager.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── ARTableViewPagerWorkspace.xcworkspace └── contents.xcworkspacedata ├── ARTableViewPager.podspec ├── Classes ├── ARTableViewPagerPageControl.h ├── ARTableViewPagerView.h ├── ARTableViewPagerPageControl.m ├── ARTableViewPagerView.m ├── ARTableViewPagerViewController.h └── ARTableViewPagerViewController.m └── README.markdown /ARTableViewPager/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ARTableViewPager/main.m: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Example/SimpleExample/SimpleExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Screenshots/screenshot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arconsis/ARTableViewPager/HEAD/Screenshots/screenshot_1.png -------------------------------------------------------------------------------- /Screenshots/screenshot_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arconsis/ARTableViewPager/HEAD/Screenshots/screenshot_2.png -------------------------------------------------------------------------------- /Screenshots/screenshot_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arconsis/ARTableViewPager/HEAD/Screenshots/screenshot_3.png -------------------------------------------------------------------------------- /.ARTableViewPager.podspec.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arconsis/ARTableViewPager/HEAD/.ARTableViewPager.podspec.swp -------------------------------------------------------------------------------- /Example/SimpleExample/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arconsis/ARTableViewPager/HEAD/Example/SimpleExample/Default-568h@2x.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Example/SimpleExample/SimpleExample.xcodeproj/xcuserdata 2 | ARTableViewPagerWorkspace.xcworkspace/xcuserdata 3 | ARTableViewPager.xcodeproj/xcuserdata 4 | ARTableViewPager.xcodeproj/project.xcworkspace/xcuserdata 5 | xcuserdata 6 | -------------------------------------------------------------------------------- /ARTableViewPager.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ARTableViewPagerWorkspace.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ARTableViewPager/ARTableViewPager-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'ARTableViewPager' target in the 'ARTableViewPager' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Example/SimpleExample/SimpleExample/SimpleExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SimpleExample' target in the 'SimpleExample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /ARTableViewPager.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'ARTableViewPager' 3 | s.version = '1.1.0' 4 | s.license = { :type => 'MIT', :file => 'README.markdown' } 5 | s.summary = 'The ARTableViewPager is an iOS component for horizontal table view scrolling/paging.' 6 | s.homepage = 'https://github.com/arconsis/ARTableViewPager' 7 | s.author = { 'arconsis IT-Solutions GmbH' => 'markus.kopf@arconsis.com' } 8 | s.source = { :git => 'https://github.com/arconsis/ARTableViewPager.git', :tag => '1.1.0' } 9 | s.platform = :ios 10 | s.source_files = 'Classes', 'Classes/**/*.{h,m}' 11 | s.clean_path = "examples" 12 | s.requires_arc = true 13 | 14 | end 15 | -------------------------------------------------------------------------------- /ARTableViewPager/ARTableViewPager-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.arconsis.moblie.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Example/SimpleExample/SimpleExample/SimpleExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.arconsis.moblie.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Example/SimpleExample/SimpleExample/SimpleTableViewPagerViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import "ARTableViewPagerViewController.h" 21 | 22 | @interface SimpleTableViewPagerViewController : ARTableViewPagerViewController 23 | @property (nonatomic, strong) NSArray *data; 24 | 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/SimpleExample/SimpleExample/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import 21 | 22 | #import "AppDelegate.h" 23 | 24 | int main(int argc, char *argv[]) 25 | { 26 | @autoreleasepool { 27 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Example/SimpleExample/SimpleExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import 21 | 22 | @interface AppDelegate : UIResponder 23 | 24 | @property (nonatomic, strong) UIWindow *window; 25 | @property (nonatomic, strong) UINavigationController *navigationController; 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Classes/ARTableViewPagerPageControl.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import 21 | 22 | @interface ARTableViewPagerPageControl : UIPageControl 23 | 24 | @property (nonatomic, strong) UIView *leftView; 25 | @property (nonatomic, strong) UIView *rightView; 26 | @property (nonatomic, strong) UIView *centerView; 27 | @property (nonatomic) BOOL showTitles; 28 | 29 | @end -------------------------------------------------------------------------------- /Classes/ARTableViewPagerView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import 21 | #import "ARTableViewPagerPageControl.h" 22 | 23 | #define PAGECONTROL_DEFAULT_HEIGHT 36 24 | @protocol ARTableViewPagerViewChanged 25 | 26 | - (void)pageChangedToTableView:(UITableView *)tableview withPageIndex:(NSUInteger)pageIndex; 27 | 28 | @end 29 | 30 | @interface ARTableViewPagerView : UIView 31 | 32 | @property (nonatomic, unsafe_unretained) id delegate; 33 | 34 | @property (nonatomic, strong, readonly) ARTableViewPagerPageControl *pageControl; 35 | @property (nonatomic, strong, readonly) UIScrollView *scrollView; 36 | 37 | // specify the content of the pageControl 38 | @property (nonatomic, strong) NSMutableArray *titleDefaultLabelStrings; 39 | @property (nonatomic, strong) NSMutableArray *titleViews; //overrides titleDetaultLabelStrings 40 | @property (nonatomic, strong) UIView *leftArrowView; 41 | @property (nonatomic, strong) UIView *rightArrowView; 42 | 43 | @property (nonatomic, strong) UIColor *pageControlBackgroundColor; 44 | @property (nonatomic, strong) UIColor *scrollingBackgroundColor; 45 | @property (nonatomic, strong) UIColor *fixedBackgroundColor; // overrides scrollingBackgroundColor 46 | @property (nonatomic, strong) UIColor *titleDefaultLabelColor; 47 | @property (nonatomic, strong) UIColor *arrowDefaultColor; 48 | 49 | @property (nonatomic) BOOL hidePageControl; 50 | @property (nonatomic) float pageControlHeight; 51 | 52 | - (void)initializeLayout; 53 | - (void)pageControlChangePage:(BOOL)animated; 54 | 55 | @end -------------------------------------------------------------------------------- /Classes/ARTableViewPagerPageControl.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import "ARTableViewPagerPageControl.h" 21 | 22 | @implementation ARTableViewPagerPageControl 23 | 24 | @synthesize leftView = _leftView; 25 | @synthesize rightView = _rightView; 26 | @synthesize centerView = _centerView; 27 | @synthesize showTitles = _showTitles; 28 | 29 | - (void)setupViewHierachy { 30 | 31 | float height = self.frame.size.height; 32 | float width = self.frame.size.width; 33 | 34 | self.backgroundColor = [UIColor whiteColor]; 35 | 36 | self.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, height)]; 37 | self.rightView = [[UIView alloc] initWithFrame:CGRectMake(width - 20, 0, 20, height)]; 38 | self.centerView = [[UIView alloc] initWithFrame:CGRectMake(20, 0, width - 40, height)]; 39 | 40 | self.leftView.backgroundColor = [UIColor clearColor]; 41 | self.rightView.backgroundColor = [UIColor clearColor]; 42 | self.centerView.backgroundColor = [UIColor clearColor]; 43 | 44 | self.leftView.autoresizesSubviews = YES; 45 | self.rightView.autoresizesSubviews = YES; 46 | self.centerView.autoresizesSubviews = YES; 47 | 48 | // Used to hide the three dots if showTitles is set to YES 49 | self.leftView.tag = 900; 50 | self.rightView.tag = 901; 51 | self.centerView.tag = 902; 52 | 53 | self.leftView.userInteractionEnabled = NO; 54 | self.rightView.userInteractionEnabled = NO; 55 | self.centerView.userInteractionEnabled = NO; 56 | 57 | [self addSubview:self.leftView]; 58 | [self addSubview:self.rightView]; 59 | [self addSubview:self.centerView]; 60 | } 61 | 62 | 63 | - (id)initWithFrame:(CGRect)frame { 64 | if ((self = [super initWithFrame:frame])) { 65 | [self setupViewHierachy]; 66 | } 67 | return self; 68 | } 69 | 70 | - (id)initWithCoder:(NSCoder *)aDecoder { 71 | if ((self = [super initWithCoder:aDecoder])) { 72 | [self setupViewHierachy]; 73 | } 74 | return self; 75 | } 76 | 77 | -(void)layoutSubviews { 78 | [super layoutSubviews]; 79 | 80 | if (self.showTitles) { 81 | NSArray *subviews = self.subviews; 82 | 83 | // hides the three dots 84 | for (UIView *v in subviews) { 85 | if (v.tag < 900 || v.tag >= 1000) { 86 | v.hidden = YES; 87 | } 88 | } 89 | } 90 | 91 | } 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /Example/SimpleExample/SimpleExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import "AppDelegate.h" 21 | #import "SimpleTableViewPagerViewController.h" 22 | 23 | @implementation AppDelegate 24 | 25 | @synthesize window = _window; 26 | @synthesize navigationController = _navigationController; 27 | 28 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 29 | { 30 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 31 | 32 | // Override point for customization after application launch. 33 | SimpleTableViewPagerViewController *simplePTVC = [[SimpleTableViewPagerViewController alloc] initWithNumberOfPages:3]; 34 | simplePTVC.title = @"Simple Pager"; 35 | simplePTVC.titleStrings = [NSArray arrayWithObjects:@"Page 0", @"Page 1", @"Page 2", nil]; 36 | simplePTVC.pageControlBackgroundColor = [UIColor lightGrayColor]; 37 | 38 | self.navigationController = [[UINavigationController alloc] initWithRootViewController:simplePTVC]; 39 | 40 | self.window.rootViewController = self.navigationController; 41 | [self.window makeKeyAndVisible]; 42 | 43 | return YES; 44 | } 45 | 46 | - (void)applicationWillResignActive:(UIApplication *)application 47 | { 48 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 49 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 50 | } 51 | 52 | - (void)applicationDidEnterBackground:(UIApplication *)application 53 | { 54 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 55 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 56 | } 57 | 58 | - (void)applicationWillEnterForeground:(UIApplication *)application 59 | { 60 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 61 | } 62 | 63 | - (void)applicationDidBecomeActive:(UIApplication *)application 64 | { 65 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 66 | } 67 | 68 | - (void)applicationWillTerminate:(UIApplication *)application 69 | { 70 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /Example/SimpleExample/SimpleExample/SimpleTableViewPagerViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import "SimpleTableViewPagerViewController.h" 21 | 22 | @implementation SimpleTableViewPagerViewController 23 | 24 | @synthesize data = _data; 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | 30 | // Do any additional setup after loading the view from its nib. 31 | 32 | self.data = [NSArray arrayWithObjects: 33 | @"AAA", @"BBB", @"CCC", @"DDD", 34 | @"AAA", @"BBB", @"CCC", @"DDD", 35 | @"AAA", @"BBB", @"CCC", @"DDD", 36 | @"AAA", @"BBB", @"CCC", @"DDD", 37 | @"AAA", @"BBB", @"CCC", @"DDD", 38 | @"AAA", @"BBB", @"CCC", @"DDD", 39 | @"AAA", @"BBB", @"CCC", @"DDD", 40 | @"AAA", @"BBB", @"CCC", @"DDD", 41 | @"AAA", @"BBB", @"CCC", @"DDD", nil]; 42 | 43 | UITableView *tableViewPage0 = [self tableViewForPageIndex:0]; 44 | tableViewPage0.separatorColor = [UIColor redColor]; 45 | tableViewPage0.backgroundColor = [UIColor yellowColor]; 46 | 47 | UITableView *tableViewPage1 = [self tableViewForPageIndex:1]; 48 | tableViewPage1.separatorColor = [UIColor blueColor]; 49 | tableViewPage1.backgroundColor = [UIColor greenColor]; 50 | 51 | // Insert a Button to move to the first page programmatically 52 | UIBarButtonItem *goToFirstPage = [[UIBarButtonItem alloc] initWithTitle:@"1st page" 53 | style:UIBarButtonItemStylePlain 54 | target:self 55 | action:@selector(goToFirstPage)]; 56 | self.navigationItem.leftBarButtonItem = goToFirstPage; 57 | } 58 | 59 | - (void)viewDidUnload 60 | { 61 | [super viewDidUnload]; 62 | // Release any retained subviews of the main view. 63 | // e.g. self.myOutlet = nil; 64 | } 65 | 66 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 67 | { 68 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 69 | } 70 | 71 | - (void)goToFirstPage 72 | { 73 | [self moveToPageAtIndex:0 animated:YES]; 74 | } 75 | 76 | #pragma mark - Paging view data source 77 | 78 | - (NSInteger)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 79 | { 80 | // Return the number of rows in the section. 81 | return [self.data count]; 82 | } 83 | 84 | 85 | - (UITableViewCell *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 86 | { 87 | static NSString *CellIdentifier = @"Cell"; 88 | 89 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 90 | if (cell == nil) { 91 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 92 | } 93 | 94 | // Configure the cell... 95 | NSString *d = [self.data objectAtIndex:indexPath.row]; 96 | cell.textLabel.text = [NSString stringWithFormat:@"%@ : %d", d, pageIndex]; 97 | 98 | return cell; 99 | } 100 | 101 | #pragma mark - Paging view delegate 102 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 103 | { 104 | // Navigation logic may go here. Create and push another view controller. 105 | 106 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 107 | 108 | NSString *d = [self.data objectAtIndex:indexPath.row]; 109 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" 110 | message:[NSString stringWithFormat:@"%@ : %d", d, pageIndex] 111 | delegate:nil 112 | cancelButtonTitle:@"Cancel" 113 | otherButtonTitles:nil]; 114 | [alert show]; 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | ARTableViewPager 2 | =============== 3 | 4 | The ARTableViewPager is an iOS component for horizontal table view scrolling/paging. 5 | 6 | This component gives you the possibility to manage multiple UITableViews with one ViewController. To change the displayed table view you can either use a swipe gesture or the PageControl in the header. Its very easy to use just like the standard UITableViewController. You simply subclass ARTableViewPagerViewController! 7 | 8 | ![](https://github.com/arconsis/ARTableViewPager/raw/master/Screenshots/screenshot_1.png) -> ![](https://github.com/arconsis/ARTableViewPager/raw/master/Screenshots/screenshot_2.png) -> ![](https://github.com/arconsis/ARTableViewPager/raw/master/Screenshots/screenshot_3.png) 9 | 10 | Please enjoy this framework! 11 | 12 | Features: 13 | ------- 14 | 15 | - manage multiple UITableViews with one ViewController 16 | - horizontal scrolling/paging to switch between the table views 17 | - very easy to use but also highly customizable 18 | - supports all UITableView delegate methods with an additional parameter which contains the page index. 19 | - uses ARC 20 | - MIT open source licence 21 | 22 | How to use 23 | --------- 24 | 25 | 1. Create a subclass of the `ARTableViewPagerViewController` 26 | 27 | In your subclass you have to implement the delegate methods to setup the table views. The ARTableViewPager extents the UITableView delegate methods by the page index so you can setup the ViewController just like a normal UITableViewController but within the methods you can do something different for each page index. 28 | 29 | With the `tableviews` or the `tableViewForPageIndex:` methods you can access the table views and do some additional configuration to them. 30 | 31 | 2. Create an instance of your Subclass with one of the initializers e.g. `initWithNumberOfPages:` 32 | 33 | 3. _optional:_ Configure the instance using the build in properties 34 | 35 | 4. Add it to the screen. 36 | _Note: If you use the ARTableViewPager with a UINavigationController you have to adjust the frame first by setting the frame property of the view controller like in the Simple Example._ 37 | 38 | Properties 39 | -------- 40 | 41 | ####titleStrings 42 | Specify the title String for each page. If you use this property a default View is used to present the title. 43 | 44 | ####titleViews 45 | Use your own View to present the title of the pages. This property overrides the titles from the `titleStrings` property. The size is automatically scaled to fit into the pageControl header. 46 | 47 | ####leftArrowView 48 | Customize the View displayed on the left side of the PageControl header. If this property is nil a default view is used. 49 | 50 | ####rightArrowView 51 | Customize the View displayed on the right side of the pageControl header. If this property is nil a default view is used. 52 | 53 | ####pageControlBackgroundColor 54 | The default background color of the pageControl header. 55 | 56 | ####pageControlHeight 57 | The height of the pageControl header. This property have to be set before the view is displayed on screen. 58 | 59 | ####hidePageControl 60 | If set to YES no header is shown. 61 | 62 | ####fixedBackgroundColor 63 | The background color behind the table views. It doesn't scroll whit the table views. 64 | 65 | ####scrollingBackgroundColor 66 | The background color behind the table views. It overlays the `fixedBackgroundColor` and scrolls with the table views. 67 | 68 | ####numberOfPages 69 | The total page count. 70 | 71 | ####tableViewPagerView 72 | The view conturing the paging control and the pageControl header. 73 | 74 | Methods 75 | ------- 76 | 77 | ####initWithNumberOfPages 78 | Initialize the TableViewPager with a number of Pages. It automatically creates the correct number of table views. 79 | 80 | ####initWithTitleViews 81 | Initialize the TableViewPager with an array of Views containing the titles for each page. 82 | 83 | ####initWithTitleStrings 84 | Initialize the TableViewPager with an array of title strings for each page. 85 | 86 | ####tableViews 87 | Get the array of all used UITableViews. The position in the array corresponds with the index of the page the table view is displayed. 88 | 89 | ####tableViewForPageIndex 90 | Get the specific UITableView for a certain page index. 91 | 92 | ####currentPageIndex 93 | Gives you the page index of the current displayed page. 94 | 95 | ####moveToPageAtIndex:animated 96 | Changes the displayed page to the given page index. If animated is YES the change is animated with a swipe. 97 | 98 | Licence 99 | ---------- 100 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 101 | 102 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 103 | associated documentation files (the "Software"), to deal in the Software without restriction, including 104 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 105 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 106 | following conditions: 107 | 108 | The above copyright notice and this permission notice shall be included in all copies or substantial 109 | portions of the Software. 110 | 111 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 112 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 113 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 114 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 115 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 116 | -------------------------------------------------------------------------------- /Classes/ARTableViewPagerView.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import "ARTableViewPagerView.h" 21 | 22 | @interface ARTableViewPagerView () 23 | 24 | @property (nonatomic, strong) ARTableViewPagerPageControl *pageControl; 25 | @property (nonatomic, strong) UIScrollView *scrollView; 26 | 27 | @property (nonatomic) BOOL pageControlBeingUsed; 28 | 29 | - (void)pageChangedToTableView:(UITableView *)tableview withPageIndex:(NSUInteger)pageIndex; 30 | - (void)setupTitleViewsForPageIndex:(NSUInteger)pageIndex; 31 | - (void)setupDefaultTitleViews; 32 | @end 33 | 34 | @implementation ARTableViewPagerView 35 | @synthesize delegate = _delegate; 36 | @synthesize pageControl = _pageControl; 37 | @synthesize hidePageControl = _hidePageControl; 38 | @synthesize pageControlHeight = _pageControlHeight; 39 | @synthesize scrollView = _scrollView; 40 | 41 | @synthesize titleViews = _titleViews; 42 | @synthesize leftArrowView = _leftArrowView; 43 | @synthesize rightArrowView = _rightArrowView; 44 | 45 | @synthesize arrowDefaultColor = _arrowDefaultColor; 46 | @synthesize pageControlBackgroundColor = _pageControlBackgroundColor; 47 | @synthesize scrollingBackgroundColor = _scrollingBackgroundColor; 48 | @synthesize fixedBackgroundColor = _fixedBackgroundColor; 49 | @synthesize titleDefaultLabelColor = _titleDefaultLabelColor; 50 | @synthesize titleDefaultLabelStrings = _titleDefaultLabelStrings; 51 | 52 | @synthesize pageControlBeingUsed = _pageControlBeingUsed; 53 | 54 | - (void)initializeLayout { 55 | 56 | // The frame must be set previsously when creating the view and can't be changed! 57 | self.backgroundColor = self.fixedBackgroundColor ? self.fixedBackgroundColor : [UIColor scrollViewTexturedBackgroundColor]; 58 | 59 | float usedPageControlHeight = self.pageControlHeight ? self.pageControlHeight : PAGECONTROL_DEFAULT_HEIGHT; 60 | 61 | if (self.hidePageControl) { 62 | usedPageControlHeight = 0; 63 | } 64 | 65 | self.pageControl = [[ARTableViewPagerPageControl alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, usedPageControlHeight)]; 66 | self.pageControl.showTitles = (self.titleViews == nil || [self.titleViews count] == 0) && (self.titleDefaultLabelStrings == nil || [self.titleDefaultLabelStrings count] == 0) ? NO : YES; 67 | if (self.pageControlBackgroundColor) { 68 | self.pageControl.backgroundColor = self.pageControlBackgroundColor; 69 | } 70 | 71 | [self.pageControl addTarget:self action:@selector(pageControlChangePage) forControlEvents:UIControlEventValueChanged]; 72 | [self addSubview:self.pageControl]; 73 | 74 | self.scrollView = [[UIScrollView alloc] init]; 75 | self.scrollView.frame = CGRectMake(self.pageControl.bounds.origin.x, self.pageControl.bounds.origin.y + usedPageControlHeight, self.bounds.size.width, self.bounds.size.height - usedPageControlHeight); 76 | self.scrollView.pagingEnabled = YES; 77 | self.scrollView.showsVerticalScrollIndicator = NO; 78 | self.scrollView.showsHorizontalScrollIndicator = NO; 79 | self.scrollView.bounces = YES; 80 | self.scrollView.alwaysBounceHorizontal = YES; 81 | self.scrollView.alwaysBounceVertical = NO; 82 | self.scrollView.backgroundColor = self.scrollingBackgroundColor ? self.scrollingBackgroundColor : [UIColor clearColor]; 83 | self.scrollView.delegate = self; 84 | self.scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 85 | [self addSubview:self.scrollView]; 86 | 87 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 88 | self.scrollView.directionalLockEnabled = YES; 89 | self.pageControlBeingUsed = NO; 90 | 91 | if (!self.titleViews && self.titleDefaultLabelStrings) { 92 | [self setupDefaultTitleViews]; 93 | } 94 | 95 | [self setupTitleViewsForPageIndex:0]; 96 | } 97 | 98 | - (id)initWithFrame:(CGRect)frame { 99 | if ((self = [super initWithFrame:frame])) { 100 | } 101 | return self; 102 | } 103 | 104 | - (id)initWithCoder:(NSCoder *)aDecoder { 105 | if ((self = [super initWithCoder:aDecoder])) { 106 | } 107 | return self; 108 | } 109 | 110 | #pragma mark - Handle scrolling 111 | 112 | - (void)scrollViewDidScroll:(UIScrollView *)sender { 113 | if (!self.pageControlBeingUsed) { 114 | // Switch the indicator when more than 50% of the previous/next page is visible 115 | CGFloat pageWidth = self.scrollView.frame.size.width; 116 | int pageIndex = floor((self.scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1; 117 | 118 | // Set boundaries if values are out of range 119 | pageIndex = pageIndex < 0 ? pageIndex = 0 : pageIndex; 120 | pageIndex = pageIndex > self.pageControl.numberOfPages - 1 ? self.pageControl.numberOfPages - 1 : pageIndex; 121 | 122 | // callback to delegate 123 | if (self.pageControl.currentPage != pageIndex) { 124 | UITableView *tableview = [self.scrollView.subviews objectAtIndex:pageIndex]; 125 | [self pageChangedToTableView:tableview withPageIndex:pageIndex]; 126 | } 127 | 128 | self.pageControl.currentPage = pageIndex; 129 | } 130 | } 131 | 132 | - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { 133 | self.pageControlBeingUsed = NO; 134 | } 135 | 136 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { 137 | self.pageControlBeingUsed = NO; 138 | self.scrollView.scrollEnabled = YES; 139 | } 140 | 141 | - (void) pageControlChangePage{ 142 | [self pageControlChangePage:YES]; 143 | } 144 | 145 | - (void) pageControlChangePage:(BOOL)animated { 146 | // Update the scroll view to the appropriate page 147 | CGRect frame; 148 | frame.origin.x = self.scrollView.frame.size.width * self.pageControl.currentPage; 149 | frame.origin.y = 0; 150 | frame.size = self.scrollView.frame.size; 151 | [self.scrollView scrollRectToVisible:frame animated:animated]; 152 | 153 | self.pageControlBeingUsed = YES; 154 | 155 | // callback to delegate 156 | UITableView *tableview = [self.scrollView.subviews objectAtIndex:self.pageControl.currentPage]; 157 | [self pageChangedToTableView:tableview withPageIndex:self.pageControl.currentPage]; 158 | } 159 | 160 | - (UIView *)defaultArrowView:(NSString *)arrowString; { 161 | UILabel *r = [[UILabel alloc] init]; 162 | r.text = arrowString; 163 | r.textColor = self.arrowDefaultColor ? self.arrowDefaultColor : [UIColor blackColor]; 164 | r.font = [UIFont boldSystemFontOfSize:18]; 165 | r.textAlignment = UITextAlignmentRight; 166 | r.backgroundColor = [UIColor clearColor]; 167 | return r; 168 | } 169 | 170 | - (void)setupTitleViewsForPageIndex:(NSUInteger)pageIndex { 171 | [[self.pageControl.leftView.subviews lastObject] removeFromSuperview]; 172 | [[self.pageControl.rightView.subviews lastObject] removeFromSuperview]; 173 | [[self.pageControl.centerView.subviews lastObject] removeFromSuperview]; 174 | 175 | if (self.titleViews && pageIndex > 0) { 176 | UIView *l = self.leftArrowView ? self.leftArrowView : [self defaultArrowView:@" <"]; 177 | [self.pageControl.leftView addSubview:l]; 178 | l.frame = self.pageControl.leftView.bounds; 179 | } 180 | 181 | if (self.titleViews && pageIndex < self.pageControl.numberOfPages - 1) { 182 | UIView *r = self.rightArrowView ? self.rightArrowView : [self defaultArrowView:@"> "]; 183 | [self.pageControl.rightView addSubview:r]; 184 | r.frame = self.pageControl.rightView.bounds; 185 | } 186 | 187 | UIView *c = [self.titleViews objectAtIndex:pageIndex]; 188 | [self.pageControl.centerView addSubview:c]; 189 | c.frame = self.pageControl.centerView.bounds; 190 | } 191 | 192 | -(void)pageChangedToTableView:(UITableView *)tableview withPageIndex:(NSUInteger)pageIndex { 193 | [self setupTitleViewsForPageIndex:pageIndex]; 194 | [self.delegate pageChangedToTableView:tableview withPageIndex:pageIndex]; 195 | } 196 | 197 | - (void)setupDefaultTitleViews { 198 | self.titleViews = [NSMutableArray arrayWithCapacity:[self.titleDefaultLabelStrings count]]; 199 | for (NSString *title in self.titleDefaultLabelStrings) { 200 | UILabel *label = [[UILabel alloc] init]; 201 | label.text = title; 202 | label.textAlignment = UITextAlignmentCenter; 203 | label.textColor = self.titleDefaultLabelColor ? self.titleDefaultLabelColor : [UIColor blackColor]; 204 | label.backgroundColor = [UIColor clearColor]; 205 | label.font = [UIFont boldSystemFontOfSize:18]; 206 | [self.titleViews addObject:label]; 207 | } 208 | } 209 | 210 | @end 211 | -------------------------------------------------------------------------------- /Classes/ARTableViewPagerViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import 21 | #import "ARTableViewPagerView.h" 22 | 23 | 24 | @protocol ARTableViewPagerDataSource 25 | 26 | #pragma mark - Paging view data source 27 | 28 | @required 29 | - (NSInteger)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; 30 | 31 | - (UITableViewCell *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; 32 | 33 | 34 | @optional 35 | - (NSInteger)pageIndex:(NSUInteger)pageIndex numberOfSectionsInTableView:(UITableView *)tableView; 36 | 37 | 38 | - (NSString *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; 39 | - (NSString *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section; 40 | 41 | // Editing 42 | 43 | // Individual rows can opt out of having the -editing property set for them. If not implemented, all rows are assumed to be editable. 44 | - (BOOL)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath; 45 | 46 | // Moving/reordering 47 | 48 | // Allows the reorder accessory view to optionally be shown for a particular row. By default, the reorder control will be shown only if the datasource implements -tableView:moveRowAtIndexPath:toIndexPath: 49 | - (BOOL)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath; 50 | 51 | // Index 52 | 53 | - (NSArray *)pageIndex:(NSUInteger)pageIndex sectionIndexTitlesForTableView:(UITableView *)tableView; // return list of section titles to display in section index view (e.g. "ABCD...Z#") 54 | - (NSInteger)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index; // tell table which section corresponds to section title/index (e.g. "B",1)) 55 | 56 | // Data manipulation - insert and delete support 57 | 58 | // After a row has the minus or plus button invoked (based on the UITableViewCellEditingStyle for the cell), the dataSource must commit the change 59 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath; 60 | 61 | // Data manipulation - reorder / moving support 62 | 63 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath; 64 | 65 | @end 66 | 67 | #pragma mark - Paging view delegate 68 | @protocol ARTableViewPagerDelegate 69 | 70 | @optional 71 | 72 | // Display customization 73 | 74 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath; 75 | 76 | // Variable height support 77 | 78 | - (CGFloat)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; 79 | - (CGFloat)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section; 80 | - (CGFloat)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section; 81 | 82 | // Section header & footer information. Views are preferred over title should you decide to provide both 83 | 84 | - (UIView *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section; // custom view for header. will be adjusted to default or specified header height 85 | - (UIView *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; // custom view for footer. will be adjusted to default or specified footer height 86 | 87 | // Accessories (disclosures). 88 | 89 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath; 90 | 91 | // Selection 92 | 93 | // Called before the user changes the selection. Return a new indexPath, or nil, to change the proposed selection. 94 | - (NSIndexPath *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath; 95 | - (NSIndexPath *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); 96 | // Called after the user changes the selection. 97 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; 98 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); 99 | 100 | // Editing 101 | 102 | // Allows customization of the editingStyle for a particular cell located at 'indexPath'. If not implemented, all editable cells will have UITableViewCellEditingStyleDelete set for them when the table has editing property set to YES. 103 | - (UITableViewCellEditingStyle)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath; 104 | - (NSString *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); 105 | 106 | // Controls whether the background is indented while editing. If not implemented, the default is YES. This is unrelated to the indentation level below. This method only applies to grouped style table views. 107 | - (BOOL)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath; 108 | 109 | // The willBegin/didEnd methods are called whenever the 'editing' property is automatically changed by the table (allowing insert/delete/move). This is done by a swipe activating a single row 110 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath; 111 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath; 112 | 113 | // Moving/reordering 114 | 115 | // Allows customization of the target row for a particular row as it is being moved/reordered 116 | - (NSIndexPath *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath; 117 | 118 | // Indentation 119 | 120 | - (NSInteger)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath; // return 'depth' of row for hierarchies 121 | 122 | // Copy/Paste. All three methods must be implemented by the delegate. 123 | 124 | - (BOOL)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); 125 | - (BOOL)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); 126 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); 127 | 128 | @end 129 | 130 | @interface ARTableViewPagerViewController : UIViewController 131 | 132 | @property (strong, nonatomic, readonly) ARTableViewPagerView *tableViewPagerView; 133 | @property (nonatomic, readonly) NSUInteger numberOfPages; 134 | 135 | // this property is deprecated and will not be used anymore 136 | @property (nonatomic) CGRect frame; 137 | 138 | // controle the page control header 139 | @property (nonatomic, strong) UIColor *pageControlBackgroundColor; 140 | @property (nonatomic) BOOL hidePageControl; 141 | @property (nonatomic) float pageControlHeight; 142 | 143 | // set the background color auf the paging table 144 | @property (nonatomic, strong) UIColor *fixedBackgroundColor; 145 | @property (nonatomic, strong) UIColor *scrollingBackgroundColor; //overrides the fixedBackgroundColor 146 | 147 | // set Views used in the page control 148 | @property (nonatomic, strong) NSArray *titleStrings; // using default views for the titles 149 | @property (nonatomic, strong) NSArray *titleViews; // overrides the stings from titleStrings 150 | @property (nonatomic, strong) UIView *leftArrowView; 151 | @property (nonatomic, strong) UIView *rightArrowView; 152 | 153 | - (id)initWithNumberOfPages:(NSUInteger)numberOfPages; 154 | - (id)initWithTitleViews:(NSArray *)titleViews; 155 | - (id)initWithTitleStrings:(NSArray *)titleStrings; 156 | 157 | - (NSArray *)tableViews; 158 | - (UITableView *)tableViewForPageIndex:(NSUInteger)pageIndex; 159 | - (NSUInteger) currentPageIndex; 160 | - (void)moveToPageAtIndex:(NSUInteger)pageIndex animated:(BOOL)animated; 161 | 162 | @end 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /ARTableViewPager.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D77AE4BC1511E935007DB396 /* ARTableViewPagerPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = D77AE4B61511E935007DB396 /* ARTableViewPagerPageControl.m */; }; 11 | D77AE4BD1511E935007DB396 /* ARTableViewPagerView.m in Sources */ = {isa = PBXBuildFile; fileRef = D77AE4B71511E935007DB396 /* ARTableViewPagerView.m */; }; 12 | D77AE4BE1511E935007DB396 /* ARTableViewPagerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D77AE4B81511E935007DB396 /* ARTableViewPagerViewController.m */; }; 13 | D77AE4C01511EA5A007DB396 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D77AE4BF1511EA5A007DB396 /* main.m */; }; 14 | D7E0D561150FC32D00DFC6C8 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D7E0D560150FC32D00DFC6C8 /* UIKit.framework */; }; 15 | D7E0D563150FC32D00DFC6C8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D7E0D562150FC32D00DFC6C8 /* Foundation.framework */; }; 16 | D7E0D565150FC32D00DFC6C8 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D7E0D564150FC32D00DFC6C8 /* CoreGraphics.framework */; }; 17 | D7E0D56B150FC32D00DFC6C8 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D7E0D569150FC32D00DFC6C8 /* InfoPlist.strings */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | D77AE4B61511E935007DB396 /* ARTableViewPagerPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ARTableViewPagerPageControl.m; path = Classes/ARTableViewPagerPageControl.m; sourceTree = SOURCE_ROOT; }; 22 | D77AE4B71511E935007DB396 /* ARTableViewPagerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ARTableViewPagerView.m; path = Classes/ARTableViewPagerView.m; sourceTree = SOURCE_ROOT; }; 23 | D77AE4B81511E935007DB396 /* ARTableViewPagerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ARTableViewPagerViewController.m; path = Classes/ARTableViewPagerViewController.m; sourceTree = SOURCE_ROOT; }; 24 | D77AE4B91511E935007DB396 /* ARTableViewPagerPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; name = ARTableViewPagerPageControl.h; path = Classes/ARTableViewPagerPageControl.h; sourceTree = SOURCE_ROOT; }; 25 | D77AE4BA1511E935007DB396 /* ARTableViewPagerView.h */ = {isa = PBXFileReference; fileEncoding = 4; name = ARTableViewPagerView.h; path = Classes/ARTableViewPagerView.h; sourceTree = SOURCE_ROOT; }; 26 | D77AE4BB1511E935007DB396 /* ARTableViewPagerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; name = ARTableViewPagerViewController.h; path = Classes/ARTableViewPagerViewController.h; sourceTree = SOURCE_ROOT; }; 27 | D77AE4BF1511EA5A007DB396 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 28 | D7E0D55C150FC32D00DFC6C8 /* ARTableViewPager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ARTableViewPager.app; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | D7E0D560150FC32D00DFC6C8 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 30 | D7E0D562150FC32D00DFC6C8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 31 | D7E0D564150FC32D00DFC6C8 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 32 | D7E0D568150FC32D00DFC6C8 /* ARTableViewPager-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ARTableViewPager-Info.plist"; sourceTree = ""; }; 33 | D7E0D56A150FC32D00DFC6C8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 34 | D7E0D56E150FC32D00DFC6C8 /* ARTableViewPager-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ARTableViewPager-Prefix.pch"; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | D7E0D559150FC32D00DFC6C8 /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | D7E0D561150FC32D00DFC6C8 /* UIKit.framework in Frameworks */, 43 | D7E0D563150FC32D00DFC6C8 /* Foundation.framework in Frameworks */, 44 | D7E0D565150FC32D00DFC6C8 /* CoreGraphics.framework in Frameworks */, 45 | ); 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | /* End PBXFrameworksBuildPhase section */ 49 | 50 | /* Begin PBXGroup section */ 51 | D7E0D551150FC32D00DFC6C8 = { 52 | isa = PBXGroup; 53 | children = ( 54 | D7E0D566150FC32D00DFC6C8 /* ARTableViewPager */, 55 | D7E0D567150FC32D00DFC6C8 /* Supporting Files */, 56 | D7E0D55F150FC32D00DFC6C8 /* Frameworks */, 57 | D7E0D55D150FC32D00DFC6C8 /* Products */, 58 | ); 59 | sourceTree = ""; 60 | }; 61 | D7E0D55D150FC32D00DFC6C8 /* Products */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | D7E0D55C150FC32D00DFC6C8 /* ARTableViewPager.app */, 65 | ); 66 | name = Products; 67 | sourceTree = ""; 68 | }; 69 | D7E0D55F150FC32D00DFC6C8 /* Frameworks */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | D7E0D560150FC32D00DFC6C8 /* UIKit.framework */, 73 | D7E0D562150FC32D00DFC6C8 /* Foundation.framework */, 74 | D7E0D564150FC32D00DFC6C8 /* CoreGraphics.framework */, 75 | ); 76 | name = Frameworks; 77 | sourceTree = ""; 78 | }; 79 | D7E0D566150FC32D00DFC6C8 /* ARTableViewPager */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | D77AE4B91511E935007DB396 /* ARTableViewPagerPageControl.h */, 83 | D77AE4B61511E935007DB396 /* ARTableViewPagerPageControl.m */, 84 | D77AE4BA1511E935007DB396 /* ARTableViewPagerView.h */, 85 | D77AE4B71511E935007DB396 /* ARTableViewPagerView.m */, 86 | D77AE4BB1511E935007DB396 /* ARTableViewPagerViewController.h */, 87 | D77AE4B81511E935007DB396 /* ARTableViewPagerViewController.m */, 88 | ); 89 | path = ARTableViewPager; 90 | sourceTree = ""; 91 | }; 92 | D7E0D567150FC32D00DFC6C8 /* Supporting Files */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | D77AE4BF1511EA5A007DB396 /* main.m */, 96 | D7E0D568150FC32D00DFC6C8 /* ARTableViewPager-Info.plist */, 97 | D7E0D569150FC32D00DFC6C8 /* InfoPlist.strings */, 98 | D7E0D56E150FC32D00DFC6C8 /* ARTableViewPager-Prefix.pch */, 99 | ); 100 | name = "Supporting Files"; 101 | path = ARTableViewPager; 102 | sourceTree = ""; 103 | }; 104 | /* End PBXGroup section */ 105 | 106 | /* Begin PBXNativeTarget section */ 107 | D7E0D55B150FC32D00DFC6C8 /* ARTableViewPager */ = { 108 | isa = PBXNativeTarget; 109 | buildConfigurationList = D7E0D574150FC32D00DFC6C8 /* Build configuration list for PBXNativeTarget "ARTableViewPager" */; 110 | buildPhases = ( 111 | D7E0D558150FC32D00DFC6C8 /* Sources */, 112 | D7E0D559150FC32D00DFC6C8 /* Frameworks */, 113 | D7E0D55A150FC32D00DFC6C8 /* Resources */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = ARTableViewPager; 120 | productName = ARTableViewPager; 121 | productReference = D7E0D55C150FC32D00DFC6C8 /* ARTableViewPager.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | D7E0D553150FC32D00DFC6C8 /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | CLASSPREFIX = AR; 131 | LastUpgradeCheck = 0430; 132 | }; 133 | buildConfigurationList = D7E0D556150FC32D00DFC6C8 /* Build configuration list for PBXProject "ARTableViewPager" */; 134 | compatibilityVersion = "Xcode 3.2"; 135 | developmentRegion = English; 136 | hasScannedForEncodings = 0; 137 | knownRegions = ( 138 | en, 139 | ); 140 | mainGroup = D7E0D551150FC32D00DFC6C8; 141 | productRefGroup = D7E0D55D150FC32D00DFC6C8 /* Products */; 142 | projectDirPath = ""; 143 | projectRoot = ""; 144 | targets = ( 145 | D7E0D55B150FC32D00DFC6C8 /* ARTableViewPager */, 146 | ); 147 | }; 148 | /* End PBXProject section */ 149 | 150 | /* Begin PBXResourcesBuildPhase section */ 151 | D7E0D55A150FC32D00DFC6C8 /* Resources */ = { 152 | isa = PBXResourcesBuildPhase; 153 | buildActionMask = 2147483647; 154 | files = ( 155 | D7E0D56B150FC32D00DFC6C8 /* InfoPlist.strings in Resources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXResourcesBuildPhase section */ 160 | 161 | /* Begin PBXSourcesBuildPhase section */ 162 | D7E0D558150FC32D00DFC6C8 /* Sources */ = { 163 | isa = PBXSourcesBuildPhase; 164 | buildActionMask = 2147483647; 165 | files = ( 166 | D77AE4BC1511E935007DB396 /* ARTableViewPagerPageControl.m in Sources */, 167 | D77AE4BD1511E935007DB396 /* ARTableViewPagerView.m in Sources */, 168 | D77AE4BE1511E935007DB396 /* ARTableViewPagerViewController.m in Sources */, 169 | D77AE4C01511EA5A007DB396 /* main.m in Sources */, 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | }; 173 | /* End PBXSourcesBuildPhase section */ 174 | 175 | /* Begin PBXVariantGroup section */ 176 | D7E0D569150FC32D00DFC6C8 /* InfoPlist.strings */ = { 177 | isa = PBXVariantGroup; 178 | children = ( 179 | D7E0D56A150FC32D00DFC6C8 /* en */, 180 | ); 181 | name = InfoPlist.strings; 182 | sourceTree = ""; 183 | }; 184 | /* End PBXVariantGroup section */ 185 | 186 | /* Begin XCBuildConfiguration section */ 187 | D7E0D572150FC32D00DFC6C8 /* Debug */ = { 188 | isa = XCBuildConfiguration; 189 | buildSettings = { 190 | ALWAYS_SEARCH_USER_PATHS = NO; 191 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 192 | CLANG_ENABLE_OBJC_ARC = YES; 193 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 194 | COPY_PHASE_STRIP = NO; 195 | GCC_C_LANGUAGE_STANDARD = gnu99; 196 | GCC_DYNAMIC_NO_PIC = NO; 197 | GCC_OPTIMIZATION_LEVEL = 0; 198 | GCC_PREPROCESSOR_DEFINITIONS = ( 199 | "DEBUG=1", 200 | "$(inherited)", 201 | ); 202 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 203 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 204 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 205 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 206 | GCC_WARN_UNUSED_VARIABLE = YES; 207 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 208 | SDKROOT = iphoneos; 209 | }; 210 | name = Debug; 211 | }; 212 | D7E0D573150FC32D00DFC6C8 /* Release */ = { 213 | isa = XCBuildConfiguration; 214 | buildSettings = { 215 | ALWAYS_SEARCH_USER_PATHS = NO; 216 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 217 | CLANG_ENABLE_OBJC_ARC = YES; 218 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 219 | COPY_PHASE_STRIP = YES; 220 | GCC_C_LANGUAGE_STANDARD = gnu99; 221 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 222 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 223 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 224 | GCC_WARN_UNUSED_VARIABLE = YES; 225 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 226 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 227 | SDKROOT = iphoneos; 228 | VALIDATE_PRODUCT = YES; 229 | }; 230 | name = Release; 231 | }; 232 | D7E0D575150FC32D00DFC6C8 /* Debug */ = { 233 | isa = XCBuildConfiguration; 234 | buildSettings = { 235 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 236 | GCC_PREFIX_HEADER = "ARTableViewPager/ARTableViewPager-Prefix.pch"; 237 | INFOPLIST_FILE = "ARTableViewPager/ARTableViewPager-Info.plist"; 238 | PRODUCT_NAME = "$(TARGET_NAME)"; 239 | WRAPPER_EXTENSION = app; 240 | }; 241 | name = Debug; 242 | }; 243 | D7E0D576150FC32D00DFC6C8 /* Release */ = { 244 | isa = XCBuildConfiguration; 245 | buildSettings = { 246 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 247 | GCC_PREFIX_HEADER = "ARTableViewPager/ARTableViewPager-Prefix.pch"; 248 | INFOPLIST_FILE = "ARTableViewPager/ARTableViewPager-Info.plist"; 249 | PRODUCT_NAME = "$(TARGET_NAME)"; 250 | WRAPPER_EXTENSION = app; 251 | }; 252 | name = Release; 253 | }; 254 | /* End XCBuildConfiguration section */ 255 | 256 | /* Begin XCConfigurationList section */ 257 | D7E0D556150FC32D00DFC6C8 /* Build configuration list for PBXProject "ARTableViewPager" */ = { 258 | isa = XCConfigurationList; 259 | buildConfigurations = ( 260 | D7E0D572150FC32D00DFC6C8 /* Debug */, 261 | D7E0D573150FC32D00DFC6C8 /* Release */, 262 | ); 263 | defaultConfigurationIsVisible = 0; 264 | defaultConfigurationName = Release; 265 | }; 266 | D7E0D574150FC32D00DFC6C8 /* Build configuration list for PBXNativeTarget "ARTableViewPager" */ = { 267 | isa = XCConfigurationList; 268 | buildConfigurations = ( 269 | D7E0D575150FC32D00DFC6C8 /* Debug */, 270 | D7E0D576150FC32D00DFC6C8 /* Release */, 271 | ); 272 | defaultConfigurationIsVisible = 0; 273 | defaultConfigurationName = Release; 274 | }; 275 | /* End XCConfigurationList section */ 276 | }; 277 | rootObject = D7E0D553150FC32D00DFC6C8 /* Project object */; 278 | } 279 | -------------------------------------------------------------------------------- /Example/SimpleExample/SimpleExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D77AE4E11511F0E7007DB396 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D77AE4E01511F0E7007DB396 /* UIKit.framework */; }; 11 | D77AE4E31511F0E7007DB396 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D77AE4E21511F0E7007DB396 /* Foundation.framework */; }; 12 | D77AE4E51511F0E7007DB396 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D77AE4E41511F0E7007DB396 /* CoreGraphics.framework */; }; 13 | D77AE4EB1511F0E7007DB396 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D77AE4E91511F0E7007DB396 /* InfoPlist.strings */; }; 14 | D77AE4ED1511F0E7007DB396 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D77AE4EC1511F0E7007DB396 /* main.m */; }; 15 | D77AE4F11511F0E7007DB396 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D77AE4F01511F0E7007DB396 /* AppDelegate.m */; }; 16 | D77AE5031511F140007DB396 /* ARTableViewPagerPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = D77AE4FD1511F140007DB396 /* ARTableViewPagerPageControl.m */; }; 17 | D77AE5041511F140007DB396 /* ARTableViewPagerView.m in Sources */ = {isa = PBXBuildFile; fileRef = D77AE4FE1511F140007DB396 /* ARTableViewPagerView.m */; }; 18 | D77AE5051511F140007DB396 /* ARTableViewPagerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D77AE4FF1511F140007DB396 /* ARTableViewPagerViewController.m */; }; 19 | D77AE5171511F319007DB396 /* SimpleTableViewPagerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D77AE5151511F319007DB396 /* SimpleTableViewPagerViewController.m */; }; 20 | D7D2E79F16CE579C00D0B682 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D7D2E79E16CE579C00D0B682 /* Default-568h@2x.png */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | D77AE4DC1511F0E7007DB396 /* SimpleExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimpleExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | D77AE4E01511F0E7007DB396 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 26 | D77AE4E21511F0E7007DB396 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 27 | D77AE4E41511F0E7007DB396 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 28 | D77AE4E81511F0E7007DB396 /* SimpleExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SimpleExample-Info.plist"; sourceTree = ""; }; 29 | D77AE4EA1511F0E7007DB396 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 30 | D77AE4EC1511F0E7007DB396 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 31 | D77AE4EE1511F0E7007DB396 /* SimpleExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SimpleExample-Prefix.pch"; sourceTree = ""; }; 32 | D77AE4EF1511F0E7007DB396 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 33 | D77AE4F01511F0E7007DB396 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 34 | D77AE4FD1511F140007DB396 /* ARTableViewPagerPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ARTableViewPagerPageControl.m; path = ../../Classes/ARTableViewPagerPageControl.m; sourceTree = ""; }; 35 | D77AE4FE1511F140007DB396 /* ARTableViewPagerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ARTableViewPagerView.m; path = ../../Classes/ARTableViewPagerView.m; sourceTree = ""; }; 36 | D77AE4FF1511F140007DB396 /* ARTableViewPagerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ARTableViewPagerViewController.m; path = ../../Classes/ARTableViewPagerViewController.m; sourceTree = ""; }; 37 | D77AE5001511F140007DB396 /* ARTableViewPagerPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARTableViewPagerPageControl.h; path = ../../Classes/ARTableViewPagerPageControl.h; sourceTree = ""; }; 38 | D77AE5011511F140007DB396 /* ARTableViewPagerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARTableViewPagerView.h; path = ../../Classes/ARTableViewPagerView.h; sourceTree = ""; }; 39 | D77AE5021511F140007DB396 /* ARTableViewPagerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARTableViewPagerViewController.h; path = ../../Classes/ARTableViewPagerViewController.h; sourceTree = ""; }; 40 | D77AE5141511F319007DB396 /* SimpleTableViewPagerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleTableViewPagerViewController.h; sourceTree = ""; }; 41 | D77AE5151511F319007DB396 /* SimpleTableViewPagerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleTableViewPagerViewController.m; sourceTree = ""; }; 42 | D7D2E79E16CE579C00D0B682 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | D77AE4D91511F0E7007DB396 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | D77AE4E11511F0E7007DB396 /* UIKit.framework in Frameworks */, 51 | D77AE4E31511F0E7007DB396 /* Foundation.framework in Frameworks */, 52 | D77AE4E51511F0E7007DB396 /* CoreGraphics.framework in Frameworks */, 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXFrameworksBuildPhase section */ 57 | 58 | /* Begin PBXGroup section */ 59 | D77AE4D11511F0E7007DB396 = { 60 | isa = PBXGroup; 61 | children = ( 62 | D7D2E79E16CE579C00D0B682 /* Default-568h@2x.png */, 63 | D77AE4FC1511F128007DB396 /* ARTableViewPager */, 64 | D77AE4E61511F0E7007DB396 /* SimpleExample */, 65 | D77AE4DF1511F0E7007DB396 /* Frameworks */, 66 | D77AE4DD1511F0E7007DB396 /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | D77AE4DD1511F0E7007DB396 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | D77AE4DC1511F0E7007DB396 /* SimpleExample.app */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | D77AE4DF1511F0E7007DB396 /* Frameworks */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | D77AE4E01511F0E7007DB396 /* UIKit.framework */, 82 | D77AE4E21511F0E7007DB396 /* Foundation.framework */, 83 | D77AE4E41511F0E7007DB396 /* CoreGraphics.framework */, 84 | ); 85 | name = Frameworks; 86 | sourceTree = ""; 87 | }; 88 | D77AE4E61511F0E7007DB396 /* SimpleExample */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | D77AE4EF1511F0E7007DB396 /* AppDelegate.h */, 92 | D77AE4F01511F0E7007DB396 /* AppDelegate.m */, 93 | D77AE5141511F319007DB396 /* SimpleTableViewPagerViewController.h */, 94 | D77AE5151511F319007DB396 /* SimpleTableViewPagerViewController.m */, 95 | D77AE4E71511F0E7007DB396 /* Supporting Files */, 96 | ); 97 | path = SimpleExample; 98 | sourceTree = ""; 99 | }; 100 | D77AE4E71511F0E7007DB396 /* Supporting Files */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | D77AE4E81511F0E7007DB396 /* SimpleExample-Info.plist */, 104 | D77AE4E91511F0E7007DB396 /* InfoPlist.strings */, 105 | D77AE4EC1511F0E7007DB396 /* main.m */, 106 | D77AE4EE1511F0E7007DB396 /* SimpleExample-Prefix.pch */, 107 | ); 108 | name = "Supporting Files"; 109 | sourceTree = ""; 110 | }; 111 | D77AE4FC1511F128007DB396 /* ARTableViewPager */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | D77AE4FD1511F140007DB396 /* ARTableViewPagerPageControl.m */, 115 | D77AE4FE1511F140007DB396 /* ARTableViewPagerView.m */, 116 | D77AE4FF1511F140007DB396 /* ARTableViewPagerViewController.m */, 117 | D77AE5001511F140007DB396 /* ARTableViewPagerPageControl.h */, 118 | D77AE5011511F140007DB396 /* ARTableViewPagerView.h */, 119 | D77AE5021511F140007DB396 /* ARTableViewPagerViewController.h */, 120 | ); 121 | name = ARTableViewPager; 122 | sourceTree = ""; 123 | }; 124 | /* End PBXGroup section */ 125 | 126 | /* Begin PBXNativeTarget section */ 127 | D77AE4DB1511F0E7007DB396 /* SimpleExample */ = { 128 | isa = PBXNativeTarget; 129 | buildConfigurationList = D77AE4F41511F0E7007DB396 /* Build configuration list for PBXNativeTarget "SimpleExample" */; 130 | buildPhases = ( 131 | D77AE4D81511F0E7007DB396 /* Sources */, 132 | D77AE4D91511F0E7007DB396 /* Frameworks */, 133 | D77AE4DA1511F0E7007DB396 /* Resources */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | ); 139 | name = SimpleExample; 140 | productName = SimpleExample; 141 | productReference = D77AE4DC1511F0E7007DB396 /* SimpleExample.app */; 142 | productType = "com.apple.product-type.application"; 143 | }; 144 | /* End PBXNativeTarget section */ 145 | 146 | /* Begin PBXProject section */ 147 | D77AE4D31511F0E7007DB396 /* Project object */ = { 148 | isa = PBXProject; 149 | attributes = { 150 | LastUpgradeCheck = 0430; 151 | }; 152 | buildConfigurationList = D77AE4D61511F0E7007DB396 /* Build configuration list for PBXProject "SimpleExample" */; 153 | compatibilityVersion = "Xcode 3.2"; 154 | developmentRegion = English; 155 | hasScannedForEncodings = 0; 156 | knownRegions = ( 157 | en, 158 | ); 159 | mainGroup = D77AE4D11511F0E7007DB396; 160 | productRefGroup = D77AE4DD1511F0E7007DB396 /* Products */; 161 | projectDirPath = ""; 162 | projectRoot = ""; 163 | targets = ( 164 | D77AE4DB1511F0E7007DB396 /* SimpleExample */, 165 | ); 166 | }; 167 | /* End PBXProject section */ 168 | 169 | /* Begin PBXResourcesBuildPhase section */ 170 | D77AE4DA1511F0E7007DB396 /* Resources */ = { 171 | isa = PBXResourcesBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | D77AE4EB1511F0E7007DB396 /* InfoPlist.strings in Resources */, 175 | D7D2E79F16CE579C00D0B682 /* Default-568h@2x.png in Resources */, 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | }; 179 | /* End PBXResourcesBuildPhase section */ 180 | 181 | /* Begin PBXSourcesBuildPhase section */ 182 | D77AE4D81511F0E7007DB396 /* Sources */ = { 183 | isa = PBXSourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | D77AE4ED1511F0E7007DB396 /* main.m in Sources */, 187 | D77AE4F11511F0E7007DB396 /* AppDelegate.m in Sources */, 188 | D77AE5031511F140007DB396 /* ARTableViewPagerPageControl.m in Sources */, 189 | D77AE5041511F140007DB396 /* ARTableViewPagerView.m in Sources */, 190 | D77AE5051511F140007DB396 /* ARTableViewPagerViewController.m in Sources */, 191 | D77AE5171511F319007DB396 /* SimpleTableViewPagerViewController.m in Sources */, 192 | ); 193 | runOnlyForDeploymentPostprocessing = 0; 194 | }; 195 | /* End PBXSourcesBuildPhase section */ 196 | 197 | /* Begin PBXVariantGroup section */ 198 | D77AE4E91511F0E7007DB396 /* InfoPlist.strings */ = { 199 | isa = PBXVariantGroup; 200 | children = ( 201 | D77AE4EA1511F0E7007DB396 /* en */, 202 | ); 203 | name = InfoPlist.strings; 204 | sourceTree = ""; 205 | }; 206 | /* End PBXVariantGroup section */ 207 | 208 | /* Begin XCBuildConfiguration section */ 209 | D77AE4F21511F0E7007DB396 /* Debug */ = { 210 | isa = XCBuildConfiguration; 211 | buildSettings = { 212 | ALWAYS_SEARCH_USER_PATHS = NO; 213 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 214 | CLANG_ENABLE_OBJC_ARC = YES; 215 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 216 | COPY_PHASE_STRIP = NO; 217 | GCC_C_LANGUAGE_STANDARD = gnu99; 218 | GCC_DYNAMIC_NO_PIC = NO; 219 | GCC_OPTIMIZATION_LEVEL = 0; 220 | GCC_PREPROCESSOR_DEFINITIONS = ( 221 | "DEBUG=1", 222 | "$(inherited)", 223 | ); 224 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 225 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 227 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 228 | GCC_WARN_UNUSED_VARIABLE = YES; 229 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 230 | SDKROOT = iphoneos; 231 | }; 232 | name = Debug; 233 | }; 234 | D77AE4F31511F0E7007DB396 /* Release */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 239 | CLANG_ENABLE_OBJC_ARC = YES; 240 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 241 | COPY_PHASE_STRIP = YES; 242 | GCC_C_LANGUAGE_STANDARD = gnu99; 243 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 244 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 245 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 246 | GCC_WARN_UNUSED_VARIABLE = YES; 247 | IPHONEOS_DEPLOYMENT_TARGET = 5.1; 248 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 249 | SDKROOT = iphoneos; 250 | VALIDATE_PRODUCT = YES; 251 | }; 252 | name = Release; 253 | }; 254 | D77AE4F51511F0E7007DB396 /* Debug */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 258 | GCC_PREFIX_HEADER = "SimpleExample/SimpleExample-Prefix.pch"; 259 | INFOPLIST_FILE = "SimpleExample/SimpleExample-Info.plist"; 260 | PRODUCT_NAME = "$(TARGET_NAME)"; 261 | WRAPPER_EXTENSION = app; 262 | }; 263 | name = Debug; 264 | }; 265 | D77AE4F61511F0E7007DB396 /* Release */ = { 266 | isa = XCBuildConfiguration; 267 | buildSettings = { 268 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 269 | GCC_PREFIX_HEADER = "SimpleExample/SimpleExample-Prefix.pch"; 270 | INFOPLIST_FILE = "SimpleExample/SimpleExample-Info.plist"; 271 | PRODUCT_NAME = "$(TARGET_NAME)"; 272 | WRAPPER_EXTENSION = app; 273 | }; 274 | name = Release; 275 | }; 276 | /* End XCBuildConfiguration section */ 277 | 278 | /* Begin XCConfigurationList section */ 279 | D77AE4D61511F0E7007DB396 /* Build configuration list for PBXProject "SimpleExample" */ = { 280 | isa = XCConfigurationList; 281 | buildConfigurations = ( 282 | D77AE4F21511F0E7007DB396 /* Debug */, 283 | D77AE4F31511F0E7007DB396 /* Release */, 284 | ); 285 | defaultConfigurationIsVisible = 0; 286 | defaultConfigurationName = Release; 287 | }; 288 | D77AE4F41511F0E7007DB396 /* Build configuration list for PBXNativeTarget "SimpleExample" */ = { 289 | isa = XCConfigurationList; 290 | buildConfigurations = ( 291 | D77AE4F51511F0E7007DB396 /* Debug */, 292 | D77AE4F61511F0E7007DB396 /* Release */, 293 | ); 294 | defaultConfigurationIsVisible = 0; 295 | defaultConfigurationName = Release; 296 | }; 297 | /* End XCConfigurationList section */ 298 | }; 299 | rootObject = D77AE4D31511F0E7007DB396 /* Project object */; 300 | } 301 | -------------------------------------------------------------------------------- /Classes/ARTableViewPagerViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 arconsis IT-Solutions GmbH (http://www.arconsis.com ) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 5 | associated documentation files (the "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial 11 | portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 14 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 15 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #import "ARTableViewPagerViewController.h" 21 | 22 | @interface ARTableViewPagerViewController () 23 | 24 | @property (nonatomic, strong) NSMutableArray *internalTableViews; 25 | @property (strong, nonatomic) ARTableViewPagerView *tableViewPagerView; 26 | @property (nonatomic) NSUInteger numberOfPages; 27 | 28 | @end 29 | 30 | 31 | @implementation ARTableViewPagerViewController 32 | 33 | @synthesize tableViewPagerView = _tableViewPagerView; 34 | @synthesize numberOfPages = _numberOfPages; 35 | @synthesize internalTableViews = _internalTableViews; 36 | 37 | @synthesize titleViews = _titleViews; 38 | @synthesize leftArrowView = _leftArrowView; 39 | @synthesize rightArrowView = _rightArrowView; 40 | @synthesize titleStrings = _titleStrings; 41 | 42 | @synthesize pageControlBackgroundColor = _pageControlBackgroundColor; 43 | @synthesize scrollingBackgroundColor = _scrollingBackgroundColor; 44 | @synthesize fixedBackgroundColor = _fixedBackgroundColor; 45 | 46 | @synthesize hidePageControl = _hidePageControl; 47 | @synthesize pageControlHeight = _pageControlHeight; 48 | 49 | #pragma mark - paging 50 | 51 | - (id)initWithTitleStrings:(NSArray *)titleStrings { 52 | 53 | self = [self initWithNumberOfPages:[titleStrings count]]; 54 | if (self) { 55 | self.titleStrings = titleStrings; 56 | } 57 | 58 | return self; 59 | } 60 | 61 | - (id)initWithTitleViews:(NSArray *)titleViews { 62 | 63 | self = [self initWithNumberOfPages:[titleViews count]]; 64 | 65 | if (self) { 66 | self.titleViews = titleViews; 67 | } 68 | 69 | return self; 70 | } 71 | 72 | - (id)initWithNumberOfPages:(NSUInteger)numberOfPages { 73 | 74 | if (self = [super init]) { 75 | self.numberOfPages = numberOfPages; 76 | self.internalTableViews = [NSMutableArray arrayWithCapacity:numberOfPages]; 77 | } 78 | return self; 79 | 80 | } 81 | 82 | #pragma mark - View lifecycle 83 | 84 | - (void)loadView { 85 | ARTableViewPagerView *pagingTableView = [[ARTableViewPagerView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 86 | self.view = pagingTableView; 87 | } 88 | 89 | - (void)viewDidLoad { 90 | [super viewDidLoad]; 91 | 92 | if (![self.view isKindOfClass:[ARTableViewPagerView class]]) { 93 | NSLog(@"Configuration Warning: View for PagingTableViewController must be of type PagingTableView! Setting default view."); 94 | self.view = [[ARTableViewPagerView alloc] initWithFrame:self.view.bounds]; 95 | } 96 | 97 | self.tableViewPagerView = (ARTableViewPagerView *)self.view; 98 | 99 | // Need to init the pagingTableView first with size and labels 100 | self.tableViewPagerView.titleViews = [self.titleViews mutableCopy]; 101 | self.tableViewPagerView.titleDefaultLabelStrings = [self.titleStrings mutableCopy]; 102 | self.tableViewPagerView.rightArrowView = self.rightArrowView; 103 | self.tableViewPagerView.leftArrowView = self.leftArrowView; 104 | self.tableViewPagerView.pageControlBackgroundColor = self.pageControlBackgroundColor; 105 | self.tableViewPagerView.fixedBackgroundColor = self.fixedBackgroundColor; 106 | self.tableViewPagerView.scrollingBackgroundColor = self.scrollingBackgroundColor; 107 | self.tableViewPagerView.hidePageControl = self.hidePageControl ? self.hidePageControl : NO; 108 | self.tableViewPagerView.pageControlHeight = self.pageControlHeight; 109 | 110 | self.tableViewPagerView.delegate = self; 111 | 112 | [self.tableViewPagerView initializeLayout]; 113 | 114 | // Now create the subview tableviews in the scrollView 115 | UIScrollView *scrollView = self.tableViewPagerView.scrollView; 116 | UIPageControl *pageControl = self.tableViewPagerView.pageControl; 117 | 118 | for (int i = 0; i < self.numberOfPages; i++) { 119 | CGRect frame; 120 | frame.origin.x = scrollView.frame.size.width * i; 121 | frame.origin.y = 0; 122 | frame.size = scrollView.frame.size; 123 | 124 | UITableView *subview = [[UITableView alloc] initWithFrame:frame]; 125 | subview.dataSource = self; 126 | subview.delegate = self; 127 | subview.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 128 | 129 | [scrollView addSubview:subview]; 130 | [self.internalTableViews insertObject:subview atIndex:i]; 131 | } 132 | 133 | scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * self.numberOfPages, scrollView.frame.size.height); 134 | 135 | pageControl.currentPage = 0; 136 | pageControl.numberOfPages = self.numberOfPages; 137 | } 138 | 139 | - (void)viewWillAppear:(BOOL)animated 140 | { 141 | self.tableViewPagerView.scrollView.contentSize = CGSizeMake(self.tableViewPagerView.scrollView.frame.size.width * self.numberOfPages, self.tableViewPagerView.scrollView.frame.size.height); 142 | 143 | } 144 | 145 | - (void)didReceiveMemoryWarning { 146 | // Releases the view if it doesn't have a superview. 147 | [super didReceiveMemoryWarning]; 148 | 149 | // Release any cached data, images, etc that aren't in use. 150 | } 151 | 152 | - (void)viewDidUnload { 153 | [self setTableViewPagerView:nil]; 154 | // Release any retained subviews of the main view. 155 | // e.g. self.myOutlet = nil; 156 | } 157 | 158 | 159 | #pragma mark - Public methods to use in subclass 160 | - (NSArray *)tableViews { 161 | return [NSArray arrayWithArray:self.internalTableViews]; 162 | } 163 | 164 | - (UITableView *)tableViewForPageIndex:(NSUInteger)pageIndex { 165 | return [self.internalTableViews objectAtIndex:pageIndex]; 166 | } 167 | 168 | - (NSUInteger)currentPageIndex { 169 | return self.tableViewPagerView.pageControl.currentPage; 170 | } 171 | 172 | - (void)moveToPageAtIndex:(NSUInteger)pageIndex animated:(BOOL)animated { 173 | if (pageIndex < self.numberOfPages) { 174 | self.tableViewPagerView.pageControl.currentPage = pageIndex; 175 | [self.tableViewPagerView pageControlChangePage:animated]; 176 | } 177 | } 178 | 179 | 180 | #pragma mark - Paging view delegate for receiving notifications on page change 181 | -(void)pageChangedToTableView:(UITableView *)tableview withPageIndex:(NSUInteger)pageIndex { 182 | 183 | } 184 | 185 | 186 | #pragma mark - Paging view data source to override in subclass 187 | - (NSInteger)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 188 | // Return the number of rows in the section. 189 | return 0; 190 | } 191 | 192 | - (UITableViewCell *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 193 | return nil; 194 | } 195 | 196 | // optionals 197 | - (NSInteger)pageIndex:(NSUInteger)pageIndex numberOfSectionsInTableView:(UITableView *)tableView{ 198 | // Return the number of sections. 199 | return 1; 200 | } 201 | 202 | - (NSString *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 203 | return nil; 204 | } 205 | 206 | 207 | - (NSString *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { 208 | return nil; 209 | } 210 | 211 | 212 | // Editing 213 | 214 | - (BOOL)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 215 | return NO; 216 | } 217 | 218 | // Moving/reordering 219 | 220 | - (BOOL)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { 221 | return NO; 222 | } 223 | 224 | // Index 225 | 226 | - (NSArray *)pageIndex:(NSUInteger)pageIndex sectionIndexTitlesForTableView:(UITableView *)tableView { 227 | return nil; 228 | } 229 | 230 | - (NSInteger)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index { 231 | return 0; 232 | } 233 | 234 | // Data manipulation - insert and delete support 235 | 236 | // After a row has the minus or plus button invoked (based on the UITableViewCellEditingStyle for the cell), the dataSource must commit the change 237 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 238 | } 239 | 240 | // Data manipulation - reorder / moving support 241 | 242 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath { 243 | 244 | } 245 | 246 | 247 | 248 | #pragma mark - Paging view delegate 249 | #pragma mark - Paging Table View delegate methods 250 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 251 | 252 | } 253 | 254 | // Variable height support 255 | 256 | - (CGFloat)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 257 | return 44; 258 | } 259 | 260 | - (CGFloat)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { 261 | return 0; 262 | } 263 | - (CGFloat)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 264 | return 0; 265 | } 266 | 267 | // Section header & footer information. Views are preferred over title should you decide to provide both 268 | - (UIView *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 269 | return nil; 270 | } 271 | 272 | - (UIView *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { 273 | return nil; 274 | } 275 | 276 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { 277 | 278 | } 279 | 280 | // Selection 281 | 282 | // Called before the user changes the selection. Return a new indexPath, or nil, to change the proposed selection. 283 | - (NSIndexPath *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { 284 | return indexPath; 285 | } 286 | 287 | - (NSIndexPath *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath { 288 | return indexPath; 289 | } 290 | 291 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 292 | } 293 | 294 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath { 295 | 296 | } 297 | 298 | // Editing 299 | 300 | // Allows customization of the editingStyle for a particular cell located at 'indexPath'. If not implemented, all editable cells will have UITableViewCellEditingStyleDelete set for them when the table has editing property set to YES. 301 | - (UITableViewCellEditingStyle)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { 302 | return UITableViewCellEditingStyleDelete; 303 | } 304 | 305 | - (NSString *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath { 306 | return nil; 307 | } 308 | 309 | // Controls whether the background is indented while editing. If not implemented, the default is YES. This is unrelated to the indentation level below. This method only applies to grouped style table views. 310 | - (BOOL)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath { 311 | return YES; 312 | } 313 | 314 | // The willBegin/didEnd methods are called whenever the 'editing' property is automatically changed by the table (allowing insert/delete/move). This is done by a swipe activating a single row 315 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath { 316 | 317 | } 318 | 319 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath { 320 | 321 | } 322 | 323 | // Moving/reordering 324 | 325 | // Allows customization of the target row for a particular row as it is being moved/reordered 326 | - (NSIndexPath *)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath { 327 | return nil; 328 | } 329 | 330 | // Indentation 331 | 332 | - (NSInteger)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{ 333 | return 0; 334 | } 335 | 336 | // Copy/Paste. All three methods must be implemented by the delegate. 337 | 338 | - (BOOL)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath { 339 | return NO; 340 | } 341 | 342 | - (BOOL)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { 343 | return NO; 344 | } 345 | 346 | - (void)pageIndex:(NSUInteger)pageIndex tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { 347 | 348 | } 349 | 350 | 351 | 352 | #pragma mark - Table view data source. Delegate all method calls to subclass and include pageIndex. 353 | 354 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 355 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 356 | // Return the number of rows in the section. 357 | return [self pageIndex:tableViewIndex tableView:tableView numberOfRowsInSection:section]; 358 | } 359 | 360 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 361 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 362 | return [self pageIndex:tableViewIndex tableView:tableView cellForRowAtIndexPath:indexPath]; 363 | } 364 | 365 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 366 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 367 | // Return the number of sections. 368 | return [self pageIndex:tableViewIndex numberOfSectionsInTableView:tableView]; 369 | } 370 | 371 | 372 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ 373 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 374 | return [self pageIndex:tableViewIndex tableView:tableView titleForHeaderInSection:section]; 375 | } 376 | 377 | 378 | - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { 379 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 380 | return [self pageIndex:tableViewIndex tableView:tableView titleForFooterInSection:section]; 381 | } 382 | 383 | // Editing 384 | 385 | // Individual rows can opt out of having the -editing property set for them. If not implemented, all rows are assumed to be editable. 386 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 387 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 388 | return [self pageIndex:tableViewIndex tableView:tableView canEditRowAtIndexPath:indexPath]; 389 | } 390 | 391 | // Moving/reordering 392 | 393 | // Allows the reorder accessory view to optionally be shown for a particular row. By default, the reorder control will be shown only if the datasource implements -tableView:moveRowAtIndexPath:toIndexPath: 394 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { 395 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 396 | return [self pageIndex:tableViewIndex tableView:tableView canMoveRowAtIndexPath:indexPath]; 397 | } 398 | 399 | // Index 400 | 401 | - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { 402 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 403 | return [self pageIndex:tableViewIndex sectionIndexTitlesForTableView:tableView]; 404 | } 405 | 406 | - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index { 407 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 408 | return [self pageIndex:tableViewIndex tableView:tableView sectionForSectionIndexTitle:title atIndex:index]; 409 | } 410 | 411 | // Data manipulation - insert and delete support 412 | 413 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ 414 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 415 | [self pageIndex:tableViewIndex tableView:tableView commitEditingStyle:editingStyle forRowAtIndexPath:indexPath]; 416 | } 417 | // Data manipulation - reorder / moving support 418 | 419 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{ 420 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 421 | [self pageIndex:tableViewIndex tableView:tableView moveRowAtIndexPath:sourceIndexPath toIndexPath:destinationIndexPath]; 422 | } 423 | 424 | #pragma mark - Table view data source. Delegate all method calls to subclass and include pageIndex. 425 | 426 | //@optional 427 | 428 | // Display customization 429 | 430 | - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 431 | // Return the number of rows in the section. 432 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 433 | return [self pageIndex:tableViewIndex tableView:tableView willDisplayCell:cell forRowAtIndexPath:indexPath]; 434 | } 435 | 436 | // Variable height support 437 | 438 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 439 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 440 | // Return the number of rows in the section. 441 | return [self pageIndex:tableViewIndex tableView:tableView heightForRowAtIndexPath:indexPath]; 442 | } 443 | 444 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { 445 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 446 | // Return the number of rows in the section. 447 | return [self pageIndex:tableViewIndex tableView:tableView heightForHeaderInSection:section]; 448 | } 449 | 450 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 451 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 452 | // Return the number of rows in the section. 453 | return [self pageIndex:tableViewIndex tableView:tableView heightForFooterInSection:section]; 454 | } 455 | 456 | // Section header & footer information. Views are preferred over title should you decide to provide both 457 | 458 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 459 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 460 | // Return the number of rows in the section. 461 | return [self pageIndex:tableViewIndex tableView:tableView viewForHeaderInSection:section]; 462 | } 463 | 464 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { 465 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 466 | // Return the number of rows in the section. 467 | return [self pageIndex:tableViewIndex tableView:tableView viewForFooterInSection:section]; 468 | } 469 | 470 | // Accessories (disclosures). 471 | 472 | - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { 473 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 474 | // Return the number of rows in the section. 475 | return [self pageIndex:tableViewIndex tableView:tableView accessoryButtonTappedForRowWithIndexPath:indexPath]; 476 | } 477 | 478 | // Selection 479 | 480 | // Called before the user changes the selection. Return a new indexPath, or nil, to change the proposed selection. 481 | - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { 482 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 483 | // Return the number of rows in the section. 484 | return [self pageIndex:tableViewIndex tableView:tableView willSelectRowAtIndexPath:indexPath]; 485 | } 486 | 487 | - (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath { 488 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 489 | // Return the number of rows in the section. 490 | return [self pageIndex:tableViewIndex tableView:tableView willDeselectRowAtIndexPath:indexPath]; 491 | } 492 | 493 | // Called after the user changes the selection. 494 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 495 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 496 | [self pageIndex:tableViewIndex tableView:tableView didSelectRowAtIndexPath:indexPath]; 497 | } 498 | 499 | - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath { 500 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 501 | // Return the number of rows in the section. 502 | return [self pageIndex:tableViewIndex tableView:tableView didDeselectRowAtIndexPath:indexPath]; 503 | } 504 | 505 | // Editing 506 | 507 | // Allows customization of the editingStyle for a particular cell located at 'indexPath'. If not implemented, all editable cells will have UITableViewCellEditingStyleDelete set for them when the table has editing property set to YES. 508 | - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { 509 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 510 | // Return the number of rows in the section. 511 | return [self pageIndex:tableViewIndex tableView:tableView editingStyleForRowAtIndexPath:indexPath]; 512 | } 513 | 514 | - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath { 515 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 516 | // Return the number of rows in the section. 517 | return [self pageIndex:tableViewIndex tableView:tableView titleForDeleteConfirmationButtonForRowAtIndexPath:indexPath]; 518 | } 519 | 520 | // Controls whether the background is indented while editing. If not implemented, the default is YES. This is unrelated to the indentation level below. This method only applies to grouped style table views. 521 | - (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath { 522 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 523 | // Return the number of rows in the section. 524 | return [self pageIndex:tableViewIndex tableView:tableView shouldIndentWhileEditingRowAtIndexPath:indexPath]; 525 | } 526 | 527 | // The willBegin/didEnd methods are called whenever the 'editing' property is automatically changed by the table (allowing insert/delete/move). This is done by a swipe activating a single row 528 | - (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath { 529 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 530 | // Return the number of rows in the section. 531 | return [self pageIndex:tableViewIndex tableView:tableView willBeginEditingRowAtIndexPath:indexPath]; 532 | } 533 | 534 | - (void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath { 535 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 536 | // Return the number of rows in the section. 537 | return [self pageIndex:tableViewIndex tableView:tableView didEndEditingRowAtIndexPath:indexPath]; 538 | } 539 | 540 | // Moving/reordering 541 | 542 | // Allows customization of the target row for a particular row as it is being moved/reordered 543 | - (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath { 544 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 545 | // Return the number of rows in the section. 546 | return [self pageIndex:tableViewIndex tableView:tableView targetIndexPathForMoveFromRowAtIndexPath:sourceIndexPath toProposedIndexPath:proposedDestinationIndexPath]; 547 | } 548 | 549 | // Indentation 550 | 551 | - (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath { 552 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 553 | // Return the number of rows in the section. 554 | return [self pageIndex:tableViewIndex tableView:tableView indentationLevelForRowAtIndexPath:indexPath]; 555 | } 556 | 557 | // Copy/Paste. All three methods must be implemented by the delegate. 558 | 559 | - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath { 560 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 561 | // Return the number of rows in the section. 562 | return [self pageIndex:tableViewIndex tableView:tableView shouldShowMenuForRowAtIndexPath:indexPath]; 563 | } 564 | 565 | - (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { 566 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 567 | // Return the number of rows in the section. 568 | return [self pageIndex:tableViewIndex tableView:tableView canPerformAction:action forRowAtIndexPath:indexPath withSender:sender]; 569 | } 570 | 571 | - (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { 572 | NSUInteger tableViewIndex = [self.internalTableViews indexOfObject:tableView]; 573 | // Return the number of rows in the section. 574 | return [self pageIndex:tableViewIndex tableView:tableView performAction:action forRowAtIndexPath:indexPath withSender:sender]; 575 | } 576 | 577 | @end 578 | --------------------------------------------------------------------------------