├── .gitignore ├── .travis.yml ├── Example ├── AppDelegate.h ├── AppDelegate.m ├── ChildVC │ ├── ChildBaseViewController.h │ ├── ChildBaseViewController.m │ ├── EighthViewController.h │ ├── EighthViewController.m │ ├── FifthViewController.h │ ├── FifthViewController.m │ ├── FirstViewController.h │ ├── FirstViewController.m │ ├── ForthViewController.h │ ├── ForthViewController.m │ ├── NinthViewController.h │ ├── NinthViewController.m │ ├── SecondViewController.h │ ├── SecondViewController.m │ ├── SeventhViewController.h │ ├── SeventhViewController.m │ ├── SixthViewController.h │ ├── SixthViewController.m │ ├── TestViewController.h │ ├── TestViewController.m │ ├── ThirdViewController.h │ ├── ThirdViewController.m │ ├── TopTabTestController.h │ └── TopTabTestController.m ├── ChildView │ ├── FirstTableView.h │ ├── FirstTableView.m │ ├── ForthCollectionView.h │ ├── ForthCollectionView.m │ ├── SecondTableView.h │ ├── SecondTableView.m │ ├── ThirdTableView.h │ ├── ThirdTableView.m │ ├── TopTabView.h │ └── TopTabView.m ├── Example Styles │ ├── CostomTopStyleController.h │ ├── CostomTopStyleController.m │ ├── ReloadTabsObjectsController.h │ ├── ReloadTabsObjectsController.m │ ├── ShowControllersStyleController.h │ ├── ShowControllersStyleController.m │ ├── ShowMixtureStyleController.h │ ├── ShowMixtureStyleController.m │ ├── ShowViewsStyleController.h │ └── ShowViewsStyleController.m ├── Gifs │ ├── NinaPagerViewGif1.gif │ ├── NinaPagerViewGif2.gif │ ├── NinaPagerViewGif3.gif │ ├── NinaPagerViewGif4.gif │ ├── NinaPagerViewGif5.gif │ └── Slice1.png ├── Supporting Files │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-40.png │ │ │ ├── Icon-40@2x.png │ │ │ ├── Icon-40@3x.png │ │ │ ├── Icon-60@2x.png │ │ │ ├── Icon-60@3x.png │ │ │ ├── Icon-72.png │ │ │ ├── Icon-72@2x.png │ │ │ ├── Icon-76.png │ │ │ ├── Icon-76@2x.png │ │ │ ├── Icon-83.5@2x.png │ │ │ ├── Icon-Small-50.png │ │ │ ├── Icon-Small-50@2x.png │ │ │ ├── Icon-Small.png │ │ │ ├── Icon-Small@2x.png │ │ │ ├── Icon-Small@3x.png │ │ │ ├── Icon.png │ │ │ └── Icon@2x.png │ │ ├── Contents.json │ │ ├── bank.imageset │ │ │ ├── Contents.json │ │ │ └── bank.png │ │ ├── bank_un.imageset │ │ │ ├── Contents.json │ │ │ └── bank_un.png │ │ ├── clock.imageset │ │ │ ├── Contents.json │ │ │ └── clock.png │ │ ├── clock_un.imageset │ │ │ ├── Contents.json │ │ │ └── clock_un.png │ │ ├── cup.imageset │ │ │ ├── Contents.json │ │ │ └── cup.png │ │ ├── cup_un.imageset │ │ │ ├── Contents.json │ │ │ └── cup_un.png │ │ ├── data.imageset │ │ │ ├── Contents.json │ │ │ └── data.png │ │ ├── data_un.imageset │ │ │ ├── Contents.json │ │ │ └── data_un.png │ │ ├── display.imageset │ │ │ ├── Contents.json │ │ │ └── display.png │ │ ├── display_un.imageset │ │ │ ├── Contents.json │ │ │ └── display_un.png │ │ ├── heart.imageset │ │ │ ├── Contents.json │ │ │ └── heart.png │ │ ├── heart_un.imageset │ │ │ ├── Contents.json │ │ │ └── heart_un.png │ │ ├── lab.imageset │ │ │ ├── Contents.json │ │ │ └── lab.png │ │ ├── lab_un.imageset │ │ │ ├── Contents.json │ │ │ └── lab_un.png │ │ ├── like.imageset │ │ │ ├── Contents.json │ │ │ └── like.png │ │ ├── like_un.imageset │ │ │ ├── Contents.json │ │ │ └── like_un.png │ │ ├── tv.imageset │ │ │ ├── Contents.json │ │ │ └── tv.png │ │ └── tv_un.imageset │ │ │ ├── Contents.json │ │ │ └── tv_un.png │ ├── Info.plist │ ├── LaunchScreen.storyboard │ └── main.m ├── ViewController.h ├── ViewController.m └── Xib │ └── NinaXibVC.storyboard ├── LICENSE ├── NinaPagerView.podspec ├── NinaPagerView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcshareddata │ └── xcschemes │ │ └── NinaPagerView.xcscheme └── xcuserdata │ ├── renrun.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ └── xcschememanagement.plist │ └── zhaofuyang.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── NinaPagerView.xcscheme │ └── xcschememanagement.plist ├── NinaPagerView ├── NinaBaseView.h ├── NinaBaseView.m ├── NinaPagerView.h ├── NinaPagerView.m ├── UIParameter.h ├── UIView+ViewController.h └── UIView+ViewController.m ├── NinaPagerViewCarthage ├── Info.plist └── NinaPagerViewCarthage.h ├── README.md └── README_CN.md /.gitignore: -------------------------------------------------------------------------------- 1 | # ---> Objective-C 2 | # Xcode 3 | # 4 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 5 | 6 | ## Build generated 7 | build/ 8 | DerivedData 9 | 10 | ## Various settings 11 | *.pbxuser 12 | !default.pbxuser 13 | *.mode1v3 14 | !default.mode1v3 15 | *.mode2v3 16 | !default.mode2v3 17 | *.perspectivev3 18 | !default.perspectivev3 19 | xcuserdata 20 | 21 | ## Other 22 | *.xccheckout 23 | *.moved-aside 24 | *.xcuserstate 25 | *.xcscmblueprint 26 | 27 | ## Obj-C/Swift specific 28 | *.hmap 29 | *.ipa 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | #Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | .DS_Store 47 | UserInterfaceState.xcuserstate 48 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode7 3 | xcode_project: NinaPagerView.xcodeproj 4 | xcode_scheme: NinaPagerView 5 | 6 | script: 7 | - xctool -project NinaPagerView.xcodeproj -scheme NinaPagerView -configuration Debug CODE_SIGN_IDENTITY="" -sdk iphonesimulator test -------------------------------------------------------------------------------- /Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 21 | window.backgroundColor = [UIColor whiteColor]; 22 | self.window = window; 23 | [self.window makeKeyAndVisible]; 24 | ViewController *viewC = [[ViewController alloc] init]; 25 | UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewC]; 26 | navController.navigationBar.translucent = NO; 27 | self.window.rootViewController = navController; 28 | //For test 29 | // navController.navigationBarHidden = YES; 30 | // UITabBarController *tab = [UITabBarController new]; 31 | // tab.viewControllers = @[navController]; 32 | // self.window.rootViewController = tab; 33 | return YES; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Example/ChildVC/ChildBaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ChildBaseViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/3/23. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ChildBaseViewController : UIViewController 12 | 13 | - (void)createLabel:(NSString *)yourTitleStr; 14 | - (void)createTableViewFromVC:(NSString *)yourTag; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/ChildVC/ChildBaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ChildBaseViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/3/23. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ChildBaseViewController.h" 10 | #import "UIParameter.h" 11 | #import "TestViewController.h" 12 | 13 | @interface ChildBaseViewController () 14 | @property (nonatomic, strong) UITableView *myTableView; 15 | @property (weak, nonatomic) IBOutlet UIButton *TestBtn; 16 | @property (weak, nonatomic) IBOutlet UITableView *XibTableView; 17 | @end 18 | 19 | @implementation ChildBaseViewController { 20 | NSString *indexTag; 21 | CGFloat offsetY; 22 | } 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | [self xibSettings]; 27 | } 28 | 29 | #pragma mark - public method 30 | - (void)createLabel:(NSString *)yourTitleStr { 31 | UILabel *middleLabel = [[UILabel alloc] initWithFrame:CGRectMake(FUll_VIEW_WIDTH / 2 - 80, FUll_VIEW_HEIGHT / 2 - 40 - 64 - PageBtn, 160, 80)]; 32 | if (isDebugging) { 33 | NSLog(@"加载了控制器%@",yourTitleStr); 34 | } 35 | middleLabel.text = [NSString stringWithFormat:@"第%@个视图控制器",yourTitleStr]; 36 | middleLabel.textColor =[UIColor blackColor]; 37 | middleLabel.textAlignment = NSTextAlignmentCenter; 38 | [self.view addSubview:middleLabel]; 39 | } 40 | 41 | - (void)createTableViewFromVC:(NSString *)yourTag { 42 | self.myTableView.delegate = self; 43 | self.myTableView.dataSource = self; 44 | [self.view addSubview:self.myTableView]; 45 | indexTag = yourTag; 46 | } 47 | 48 | #pragma mark - myTableView 49 | - (UITableView *)myTableView { 50 | if (!_myTableView) { 51 | _myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, FUll_VIEW_WIDTH, self.view.frame.size.height) style:UITableViewStylePlain]; 52 | } 53 | return _myTableView; 54 | } 55 | 56 | #pragma mark - UITableViewDelegate 57 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 58 | return 20; 59 | } 60 | 61 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 62 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 63 | if (cell == nil) { 64 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; 65 | cell.textLabel.text = @"NinaPagerView"; 66 | } 67 | return cell; 68 | } 69 | 70 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 71 | if (isDebugging) { 72 | NSLog(@"点击了控制器%@单元格的%li",indexTag,(long)indexPath.row); 73 | } 74 | TestViewController *testVC = [TestViewController new]; 75 | [self.navigationController pushViewController:testVC animated:YES]; 76 | } 77 | 78 | - (void)testAction { 79 | if (isDebugging) { 80 | NSLog(@"测试点击事件"); 81 | } 82 | } 83 | 84 | - (void)xibSettings { 85 | [self.TestBtn addTarget:self action:@selector(testAction) forControlEvents:UIControlEventTouchUpInside]; 86 | self.XibTableView.delegate = self; 87 | self.XibTableView.dataSource = self; 88 | } 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /Example/ChildVC/EighthViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // EighthViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/3/23. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ChildBaseViewController.h" 10 | 11 | @interface EighthViewController : ChildBaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/ChildVC/EighthViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // EighthViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/3/23. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "EighthViewController.h" 10 | 11 | @interface EighthViewController () 12 | 13 | @end 14 | 15 | @implementation EighthViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | self.view.backgroundColor = [UIColor greenColor]; 20 | } 21 | 22 | - (void)viewWillLayoutSubviews { 23 | [self createTableViewFromVC:@"8"]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/ChildVC/FifthViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FifthViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/16. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ChildBaseViewController.h" 11 | 12 | @interface FifthViewController : ChildBaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/ChildVC/FifthViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FifthViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/16. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "FifthViewController.h" 10 | #import "UIParameter.h" 11 | 12 | @interface FifthViewController () 13 | 14 | @end 15 | 16 | @implementation FifthViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | self.view.backgroundColor = [UIColor cyanColor]; 21 | } 22 | 23 | - (void)viewWillLayoutSubviews { 24 | [self createTableViewFromVC:@"5"]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Example/ChildVC/FirstViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ChildBaseViewController.h" 11 | 12 | @interface FirstViewController : ChildBaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/ChildVC/FirstViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "FirstViewController.h" 10 | #import "UIParameter.h" 11 | #import "TestViewController.h" 12 | 13 | @interface FirstViewController () 14 | @property (nonatomic, strong) UITableView *myTableView; 15 | @end 16 | 17 | @implementation FirstViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view. 22 | self.view.backgroundColor = [UIColor cyanColor]; 23 | } 24 | 25 | - (void)viewWillLayoutSubviews { 26 | self.myTableView.delegate = self; 27 | self.myTableView.dataSource = self; 28 | [self.view addSubview:self.myTableView]; 29 | } 30 | 31 | #pragma mark - myTableView 32 | - (UITableView *)myTableView { 33 | if (!_myTableView) { 34 | _myTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; 35 | } 36 | return _myTableView; 37 | } 38 | 39 | #pragma mark - UITableViewDelegate 40 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 41 | return 20; 42 | } 43 | 44 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 45 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 46 | if (cell == nil) { 47 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; 48 | cell.textLabel.text = @"NinaPagerViewTest"; 49 | } 50 | return cell; 51 | } 52 | 53 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 54 | if (isDebugging) { 55 | NSLog(@"点击了控制器1单元格的%li",(long)indexPath.row); 56 | } 57 | TestViewController *testVC = [TestViewController new]; 58 | [self.navigationController pushViewController:testVC animated:YES]; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Example/ChildVC/ForthViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ForthViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ChildBaseViewController.h" 11 | 12 | @interface ForthViewController : ChildBaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/ChildVC/ForthViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ForthViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ForthViewController.h" 10 | #import "UIParameter.h" 11 | 12 | @interface ForthViewController () 13 | 14 | @end 15 | 16 | @implementation ForthViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | self.view.backgroundColor = [UIColor blueColor]; 21 | } 22 | 23 | - (void)viewWillLayoutSubviews { 24 | [self createTableViewFromVC:@"4"]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Example/ChildVC/NinthViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NinthViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/3/23. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ChildBaseViewController.h" 10 | 11 | @interface NinthViewController : ChildBaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/ChildVC/NinthViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NinthViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/3/23. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "NinthViewController.h" 10 | 11 | @interface NinthViewController () 12 | 13 | @end 14 | 15 | @implementation NinthViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | self.view.backgroundColor = [UIColor brownColor]; 20 | } 21 | 22 | - (void)viewWillLayoutSubviews { 23 | [self createTableViewFromVC:@"9"]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/ChildVC/SecondViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ChildBaseViewController.h" 11 | 12 | @interface SecondViewController : ChildBaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/ChildVC/SecondViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "SecondViewController.h" 10 | #import "UIParameter.h" 11 | 12 | @interface SecondViewController () 13 | @end 14 | 15 | @implementation SecondViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | self.view.backgroundColor = [UIColor yellowColor]; 20 | } 21 | 22 | - (void)viewWillLayoutSubviews { 23 | [self createTableViewFromVC:@"2"]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/ChildVC/SeventhViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SeventhViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/3/23. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ChildBaseViewController.h" 10 | 11 | @interface SeventhViewController : ChildBaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/ChildVC/SeventhViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SeventhViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/3/23. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "SeventhViewController.h" 10 | 11 | @interface SeventhViewController () 12 | 13 | @end 14 | 15 | @implementation SeventhViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | self.view.backgroundColor = [UIColor cyanColor]; 20 | } 21 | 22 | - (void)viewWillLayoutSubviews { 23 | [self createTableViewFromVC:@"7"]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/ChildVC/SixthViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SixthViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/3/23. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ChildBaseViewController.h" 10 | 11 | @interface SixthViewController : ChildBaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/ChildVC/SixthViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SixthViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/3/23. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "SixthViewController.h" 10 | 11 | @interface SixthViewController () 12 | 13 | @end 14 | 15 | @implementation SixthViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | self.view.backgroundColor = [UIColor purpleColor]; 20 | } 21 | 22 | - (void)viewWillLayoutSubviews { 23 | [self createTableViewFromVC:@"6"]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/ChildVC/TestViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/4/11. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/ChildVC/TestViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/4/11. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "TestViewController.h" 10 | 11 | @interface TestViewController () 12 | 13 | @end 14 | 15 | @implementation TestViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | self.view.backgroundColor = [UIColor yellowColor]; 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | /* 28 | #pragma mark - Navigation 29 | 30 | // In a storyboard-based application, you will often want to do a little preparation before navigation 31 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 32 | // Get the new view controller using [segue destinationViewController]. 33 | // Pass the selected object to the new view controller. 34 | } 35 | */ 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Example/ChildVC/ThirdViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThirdViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ChildBaseViewController.h" 11 | 12 | @interface ThirdViewController : ChildBaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/ChildVC/ThirdViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ThirdViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ThirdViewController.h" 10 | #import "UIParameter.h" 11 | 12 | @interface ThirdViewController () 13 | 14 | @end 15 | 16 | @implementation ThirdViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | self.view.backgroundColor = [UIColor redColor]; 21 | } 22 | 23 | - (void)viewWillLayoutSubviews { 24 | [self createTableViewFromVC:@"3"]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Example/ChildVC/TopTabTestController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TopTabTestController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 2016/11/15. 6 | // Copyright © 2016年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol ScrollHiddenDelegate 12 | 13 | @optional 14 | - (void)upScrollAction:(BOOL)show; 15 | 16 | @end 17 | 18 | @interface TopTabTestController : UIViewController 19 | 20 | @property (nonatomic, weak)id upScrollDelegate; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Example/ChildVC/TopTabTestController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TopTabTestController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 2016/11/15. 6 | // Copyright © 2016年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import "TopTabTestController.h" 10 | #import "UIParameter.h" 11 | #import "TestViewController.h" 12 | 13 | @interface TopTabTestController () 14 | @property (nonatomic, strong) UITableView *myTableView; 15 | @end 16 | 17 | @implementation TopTabTestController { 18 | CGFloat offsetY; 19 | } 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | [self createTableViewFromVC]; 24 | } 25 | 26 | #pragma mark - Private Method 27 | - (void)createTableViewFromVC { 28 | self.myTableView.delegate = self; 29 | self.myTableView.dataSource = self; 30 | [self.view addSubview:self.myTableView]; 31 | } 32 | 33 | #pragma mark - myTableView 34 | - (UITableView *)myTableView { 35 | if (!_myTableView) { 36 | _myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_CONTENT_HEIGHT) style:UITableViewStylePlain]; 37 | } 38 | return _myTableView; 39 | } 40 | 41 | #pragma mark - UITableViewDelegate 42 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 43 | return 20; 44 | } 45 | 46 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 47 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 48 | if (cell == nil) { 49 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; 50 | cell.textLabel.text = @"NinaPagerView"; 51 | } 52 | return cell; 53 | } 54 | 55 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 56 | TestViewController *testVC = [TestViewController new]; 57 | [self.navigationController pushViewController:testVC animated:YES]; 58 | } 59 | 60 | - (void)testAction { 61 | if (isDebugging) { 62 | NSLog(@"测试点击事件"); 63 | } 64 | } 65 | 66 | #pragma mark - UIScrollViewDelegate 67 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 68 | if ([self.upScrollDelegate respondsToSelector:@selector(upScrollAction:)]) { 69 | if (scrollView.contentOffset.y > 0) { 70 | if (scrollView.contentOffset.y > offsetY) { 71 | [self.upScrollDelegate upScrollAction:NO]; 72 | } 73 | if (scrollView.contentOffset.y < offsetY && scrollView.contentOffset.y < PageBtn) { 74 | [self.upScrollDelegate upScrollAction:YES]; 75 | } 76 | }else { 77 | [self.upScrollDelegate upScrollAction:YES]; 78 | } 79 | } 80 | offsetY = scrollView.contentOffset.y; 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /Example/ChildView/FirstTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FirstTableView.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/5/10. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FirstTableView : UITableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/ChildView/FirstTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FirstTableView.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/5/10. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "FirstTableView.h" 10 | 11 | @implementation FirstTableView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/ChildView/ForthCollectionView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ForthCollectionView.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/6/22. 6 | // Copyright © 2016年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ForthCollectionView : UICollectionView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/ChildView/ForthCollectionView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ForthCollectionView.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/6/22. 6 | // Copyright © 2016年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import "ForthCollectionView.h" 10 | #import "UIParameter.h" 11 | static NSString *identy = @"collectionCell"; 12 | 13 | @implementation ForthCollectionView 14 | 15 | - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout { 16 | if (self = [super initWithFrame:frame collectionViewLayout:layout]) { 17 | self.backgroundColor = [UIColor whiteColor]; 18 | self.dataSource = self; 19 | self.delegate = self; 20 | [self registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:identy]; 21 | } 22 | return self; 23 | } 24 | 25 | #pragma mark - UICollectionViewDataSource 26 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 27 | return 4; 28 | } 29 | 30 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 31 | UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identy forIndexPath:indexPath]; 32 | cell.backgroundColor = [UIColor greenColor]; 33 | return cell; 34 | } 35 | 36 | //单元格大小 37 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ 38 | return CGSizeMake(FUll_VIEW_WIDTH, 80); 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Example/ChildView/SecondTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SecondTableView.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/5/10. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SecondTableView : UITableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/ChildView/SecondTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SecondTableView.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/5/10. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "SecondTableView.h" 10 | 11 | @implementation SecondTableView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/ChildView/ThirdTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThirdTableView.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/5/10. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ThirdTableView : UITableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/ChildView/ThirdTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ThirdTableView.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 16/5/10. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ThirdTableView.h" 10 | 11 | @implementation ThirdTableView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/ChildView/TopTabView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TopTabView.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 2016/11/10. 6 | // Copyright © 2016年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TopTabView : UIView 12 | 13 | - (instancetype)initWithLeftImageName:(NSString *)leftImageName WithRightTitle:(NSString *)rightTitleString WithTitleColor:(UIColor *)titleColor; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/ChildView/TopTabView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TopTabView.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 2016/11/10. 6 | // Copyright © 2016年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import "TopTabView.h" 10 | #import "UIParameter.h" 11 | 12 | @interface TopTabView() 13 | @property (strong, nonatomic) UIImageView *leftImage; 14 | @property (strong, nonatomic) UILabel *rightTitle; 15 | @end 16 | 17 | @implementation TopTabView { 18 | NSString *imageName; 19 | NSString *titleName; 20 | UIColor *myTitleColor; 21 | } 22 | 23 | - (instancetype)initWithLeftImageName:(NSString *)leftImageName WithRightTitle:(NSString *)rightTitleString WithTitleColor:(UIColor *)titleColor { 24 | if (self = [super init]) { 25 | imageName = leftImageName; 26 | titleName = rightTitleString; 27 | myTitleColor = titleColor; 28 | [self addSubview:self.leftImage]; 29 | [self addSubview:self.rightTitle]; 30 | [self initUI]; 31 | } 32 | return self; 33 | } 34 | 35 | #pragma mark - LazyLoad 36 | - (UIImageView *)leftImage { 37 | if (!_leftImage) { 38 | _leftImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]]; 39 | } 40 | return _leftImage; 41 | } 42 | 43 | - (UILabel *)rightTitle { 44 | if (!_rightTitle) { 45 | _rightTitle = [UILabel new]; 46 | _rightTitle.text = titleName; 47 | _rightTitle.textAlignment = NSTextAlignmentCenter; 48 | _rightTitle.textColor = myTitleColor; 49 | _rightTitle.font = [UIFont systemFontOfSize:14]; 50 | } 51 | return _rightTitle; 52 | } 53 | 54 | #pragma mark - LayOut 55 | - (void)initUI { 56 | self.leftImage.frame = CGRectMake(5, 10, 24, 24); 57 | self.rightTitle.frame = CGRectMake(30, 0, FUll_VIEW_WIDTH / 5 - 30, 44); 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Example/Example Styles/CostomTopStyleController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CostomTopStyleController.h 3 | // NinaPagerView 4 | // 5 | // Created by Jeff Zhao on 2017/4/18. 6 | // Copyright © 2017年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CostomTopStyleController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Example Styles/CostomTopStyleController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CostomTopStyleController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 2017/4/18. 6 | // Copyright © 2017年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "CostomTopStyleController.h" 10 | #import "UIParameter.h" 11 | #import "NinaPagerView.h" 12 | #import "TopTabView.h" 13 | 14 | @interface CostomTopStyleController () 15 | @property (nonatomic, strong) NinaPagerView *ninaPagerView; 16 | @end 17 | 18 | @implementation CostomTopStyleController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | self.title = @"CostomTopWithBottomLineStyle"; 23 | self.view.backgroundColor = [UIColor whiteColor]; 24 | [self.view addSubview:self.ninaPagerView]; 25 | } 26 | 27 | #pragma mark - NinaParaArrays 28 | - (NSArray *)ninaTitleArray { 29 | return @[ 30 | @"大连市", 31 | @"甘井子", 32 | @"星海广场", 33 | @"西岗", 34 | @"马栏子", 35 | @"革镇堡", 36 | @"沙河口", 37 | @"人民广场", 38 | @"中山广场" 39 | ]; 40 | } 41 | 42 | - (NSArray *)ninaViewsArray { 43 | return @[ 44 | @"FirstTableView", 45 | @"SecondTableView", 46 | @"ThirdTableView", 47 | @"FirstTableView", 48 | @"SecondTableView", 49 | @"ThirdTableView", 50 | @"FirstTableView", 51 | @"SecondTableView", 52 | @"ThirdTableView", 53 | ]; 54 | } 55 | 56 | /** 57 | * 未选中的自定义视图创建:示例展示的为左图右文字的一种样式,您可以根据需求对里面的内容进行子类化的创建,此数组包含的成员数量应与上方的标题和控制器数量一致(此自定义方式在NinaPagerStyleSlideBlock中并不适用)。 58 | * Normal custom topTab views creation:Example codes shows a kind of type which is left-image right-label.You can custom your views if you want.Please set topTabViewArray's count is the same with title and vcs array's count(This function doesn't support NinaPagerStyleSlideBlock mode). 59 | * 60 | * @return Array of views or controllers 61 | */ 62 | - (NSArray *)topTabViewArray { 63 | return @[ 64 | [[TopTabView alloc] initWithLeftImageName:@"bank_un" WithRightTitle:@"bank" WithTitleColor:UIColorFromRGB(0xcdcdcd)], 65 | [[TopTabView alloc] initWithLeftImageName:@"clock_un" WithRightTitle:@"clock" WithTitleColor:UIColorFromRGB(0xcdcdcd)], 66 | [[TopTabView alloc] initWithLeftImageName:@"cup_un" WithRightTitle:@"cup" WithTitleColor:UIColorFromRGB(0xcdcdcd)], 67 | [[TopTabView alloc] initWithLeftImageName:@"heart_un" WithRightTitle:@"heart"WithTitleColor:UIColorFromRGB(0xcdcdcd)], 68 | [[TopTabView alloc] initWithLeftImageName:@"lab_un" WithRightTitle:@"lab" WithTitleColor:UIColorFromRGB(0xcdcdcd)], 69 | [[TopTabView alloc] initWithLeftImageName:@"like_un" WithRightTitle:@"like" WithTitleColor:UIColorFromRGB(0xcdcdcd)], 70 | [[TopTabView alloc] initWithLeftImageName:@"data_un" WithRightTitle:@"data" WithTitleColor:UIColorFromRGB(0xcdcdcd)], 71 | [[TopTabView alloc] initWithLeftImageName:@"tv_un" WithRightTitle:@"tv" WithTitleColor:UIColorFromRGB(0xcdcdcd)], 72 | [[TopTabView alloc] initWithLeftImageName:@"display_un" WithRightTitle:@"pc" WithTitleColor:UIColorFromRGB(0xcdcdcd)], 73 | ]; 74 | } 75 | 76 | /** 77 | * 选中的自定义视图创建:示例展示的为左图右文字的一种样式,您可以根据需求对里面的内容进行子类化的创建,此数组包含的成员数量应与上方的标题和控制器数量一致(此自定义方式在NinaPagerStyleSlideBlock中并不适用)。 78 | * Selected custom topTab views creation:Example codes shows a kind of type which is left-image right-label.You can custom your views if you want.Please set topTabViewArray's count is the same with title and vcs array's count(This function doesn't support NinaPagerStyleSlideBlock mode). 79 | * 80 | * @return Array of views or controllers 81 | */ 82 | - (NSArray *)changeTopArray { 83 | return @[ 84 | [[TopTabView alloc] initWithLeftImageName:@"bank" WithRightTitle:@"bank" WithTitleColor:UIColorFromRGB(0x333333)], 85 | [[TopTabView alloc] initWithLeftImageName:@"clock" WithRightTitle:@"clock" WithTitleColor:UIColorFromRGB(0x333333)], 86 | [[TopTabView alloc] initWithLeftImageName:@"cup" WithRightTitle:@"cup" WithTitleColor:UIColorFromRGB(0x333333)], 87 | [[TopTabView alloc] initWithLeftImageName:@"heart" WithRightTitle:@"heart" WithTitleColor:UIColorFromRGB(0x333333)], 88 | [[TopTabView alloc] initWithLeftImageName:@"lab" WithRightTitle:@"lab" WithTitleColor:UIColorFromRGB(0x333333)], 89 | [[TopTabView alloc] initWithLeftImageName:@"like" WithRightTitle:@"like" WithTitleColor:UIColorFromRGB(0x333333)], 90 | [[TopTabView alloc] initWithLeftImageName:@"data" WithRightTitle:@"data" WithTitleColor:UIColorFromRGB(0x333333)], 91 | [[TopTabView alloc] initWithLeftImageName:@"tv" WithRightTitle:@"tv" WithTitleColor:UIColorFromRGB(0x333333)], 92 | [[TopTabView alloc] initWithLeftImageName:@"display" WithRightTitle:@"pc" WithTitleColor:UIColorFromRGB(0x333333)], 93 | ]; 94 | } 95 | 96 | #pragma mark - LazyLoad 97 | - (NinaPagerView *)ninaPagerView { 98 | if (!_ninaPagerView) { 99 | //Need You Edit 100 | NSArray *titleArray = [self ninaTitleArray]; 101 | NSArray *viewsArray = [self ninaViewsArray]; 102 | CGRect pagerRect = CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_CONTENT_HEIGHT); 103 | _ninaPagerView = [[NinaPagerView alloc] initWithFrame:pagerRect WithTitles:titleArray WithObjects:viewsArray]; 104 | _ninaPagerView.ninaPagerStyles = NinaPagerStyleBottomLine; 105 | _ninaPagerView.ninaDefaultPage = 0; 106 | _ninaPagerView.loadWholePages = NO; 107 | //Custom TopTab menus(optional) 108 | _ninaPagerView.topTabViews = [self topTabViewArray]; 109 | _ninaPagerView.selectedTopTabViews = [self changeTopArray]; 110 | } 111 | return _ninaPagerView; 112 | } 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /Example/Example Styles/ReloadTabsObjectsController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ReloadTabsObjectsController.h 3 | // NinaPagerView 4 | // 5 | // Created by Jeff Zhao on 2017/5/2. 6 | // Copyright © 2017年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ReloadTabsObjectsController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Example Styles/ReloadTabsObjectsController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ReloadTabsObjectsController.m 3 | // NinaPagerView 4 | // 5 | // Created by Jeff Zhao on 2017/5/2. 6 | // Copyright © 2017年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import "ReloadTabsObjectsController.h" 10 | #import "UIParameter.h" 11 | #import "NinaPagerView.h" 12 | #import "SecondViewController.h" 13 | #import "FirstTableView.h" 14 | #import "ForthCollectionView.h" 15 | #import "TopTabTestController.h" 16 | 17 | @interface ReloadTabsObjectsController () 18 | @property (nonatomic, strong) NinaPagerView *ninaPagerView; 19 | @end 20 | 21 | @implementation ReloadTabsObjectsController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | self.title = @"ReloadTabsObjectsDemo"; 26 | self.view.backgroundColor = [UIColor whiteColor]; 27 | [self.view addSubview:self.ninaPagerView]; 28 | [self performSelector:@selector(reloadTopTabAndScrollView) withObject:nil afterDelay:5.0]; 29 | } 30 | 31 | 32 | #pragma mark - NinaParaArrays 33 | - (NSArray *)ninaTitleArray { 34 | return @[ 35 | @"沙河口", 36 | @"人民广场", 37 | @"中山广场" 38 | ]; 39 | } 40 | 41 | /** 42 | * WithObjects传入方法3:适用于IB创建或者需要代码实例化创建的VC,如果您有此需求,请传入对应的VC即可,具体实现可参照下方代码。 43 | * If you think vcs is not comfortable for your project, you can use view arrays to built.Just put views into array. 44 | * 45 | * @return Array of views or controllers 46 | */ 47 | - (NSArray *)ninaDetailVCsArray { 48 | //Test init views and viewcontrollers,support creating views or viewcontroller by xib. 49 | TopTabTestController *firstVC = [TopTabTestController new]; 50 | firstVC.upScrollDelegate = self; 51 | SecondViewController *secondVC = [SecondViewController new]; 52 | FirstTableView *firstTV = [[FirstTableView alloc] initWithFrame:CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_VIEW_HEIGHT) style:UITableViewStylePlain]; 53 | return @[ 54 | firstVC, 55 | secondVC, 56 | firstTV, 57 | ]; 58 | } 59 | 60 | #pragma mark - ScrollHiddenDelegate 61 | - (void)upScrollAction:(BOOL)show { 62 | //If you wanna to make toptab hidden or show,you can try following codes and choose detailVCsArray(Line 39) as your default vcs array: 63 | // self.ninaPagerView.topTabScrollHidden = show?NO:YES; 64 | } 65 | 66 | #pragma mark - LazyLoad 67 | - (NinaPagerView *)ninaPagerView { 68 | if (!_ninaPagerView) { 69 | NSArray *titleArray = [self ninaTitleArray]; 70 | NSArray *vcsArray = [self ninaDetailVCsArray]; 71 | CGRect pagerRect = CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_CONTENT_HEIGHT); 72 | _ninaPagerView = [[NinaPagerView alloc] initWithFrame:pagerRect WithTitles:titleArray WithObjects:vcsArray]; 73 | _ninaPagerView.ninaPagerStyles = NinaPagerStyleStateNormal; 74 | } 75 | return _ninaPagerView; 76 | } 77 | 78 | #pragma mark - Reload Titles and Objects 79 | - (void)reloadTopTabAndScrollView { 80 | [self.ninaPagerView reloadTopTabByTitles:[self ninasTitleArray] WithObjects:[self ninasVCsArray]]; 81 | } 82 | 83 | - (NSArray *)ninasTitleArray { 84 | return @[ 85 | @"大连市", 86 | @"甘井子", 87 | @"人民广场", 88 | @"中山广场", 89 | @"星海广场", 90 | ]; 91 | } 92 | 93 | - (NSArray *)ninasVCsArray { 94 | UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 95 | layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; 96 | layout.minimumInteritemSpacing = 0; 97 | layout.minimumLineSpacing = 0; 98 | ForthCollectionView *forthCollectionView = [[ForthCollectionView alloc] initWithFrame:CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_CONTENT_HEIGHT) collectionViewLayout:layout]; 99 | UIStoryboard *FifthStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 100 | ChildBaseViewController *fifthVC = [FifthStory instantiateViewControllerWithIdentifier:@"111"]; 101 | UIStoryboard *sixthStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 102 | ChildBaseViewController *sixthVC = [sixthStory instantiateViewControllerWithIdentifier:@"222"]; 103 | UIStoryboard *eighthStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 104 | ChildBaseViewController *eighthVC = [eighthStory instantiateViewControllerWithIdentifier:@"444"]; 105 | UIStoryboard *ninthStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 106 | ChildBaseViewController *ninthVC = [ninthStory instantiateViewControllerWithIdentifier:@"555"]; 107 | return @[ 108 | forthCollectionView, 109 | fifthVC, 110 | sixthVC, 111 | eighthVC, 112 | ninthVC 113 | ]; 114 | } 115 | 116 | @end 117 | -------------------------------------------------------------------------------- /Example/Example Styles/ShowControllersStyleController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ShowControllersStyleController.h 3 | // NinaPagerView 4 | // 5 | // Created by Jeff Zhao on 2017/4/18. 6 | // Copyright © 2017年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ShowControllersStyleController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Example Styles/ShowControllersStyleController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ShowControllersStyleController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 2017/4/18. 6 | // Copyright © 2017年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ShowControllersStyleController.h" 10 | #import "UIParameter.h" 11 | #import "NinaPagerView.h" 12 | 13 | @interface ShowControllersStyleController () 14 | @property (nonatomic, strong) NinaPagerView *ninaPagerView; 15 | @end 16 | 17 | @implementation ShowControllersStyleController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | self.title = @"ShowControllersWithBottomLineStyle"; 22 | self.view.backgroundColor = [UIColor whiteColor]; 23 | [self.view addSubview:self.ninaPagerView]; 24 | } 25 | 26 | #pragma mark - NinaParaArrays 27 | /** 28 | * 上方显示标题(您需要注意的是,虽然框架中对长标题进行了优化处理,但是建议您设置标题时汉字的长度不要超过10)。 29 | * Titles showing on the topTab 30 | * 31 | * @return Array of titles. 32 | */ 33 | - (NSArray *)ninaTitleArray { 34 | return @[ 35 | @"大连市", 36 | @"甘井子", 37 | @"星海广场", 38 | @"西岗", 39 | @"马栏子", 40 | @"革镇堡", 41 | @"沙河口", 42 | @"人民广场", 43 | @"中山广场" 44 | ]; 45 | } 46 | 47 | /** 48 | * WithObjects传入方法1:每个标题下对应的控制器,只需将您创建的控制器类名加入下列数组即可(注意:数量应与上方的titles数量保持一致,若少于titles数量,下方会打印您缺少相应的控制器,同时默认设置的最大控制器数量为10) 。 49 | * ViewControllers to the titles on the topTab.Just add your VCs' Class Name to the array. Wanning:the number of ViewControllers should equal to the titles.Meanwhile,default max VC number is 10. 50 | * 51 | * @return Array of controllers' class names. 52 | */ 53 | - (NSArray *)ninaVCsArray { 54 | return @[ 55 | @"FirstViewController", 56 | @"SecondViewController", 57 | @"ThirdViewController", 58 | @"ForthViewController", 59 | @"FifthViewController", 60 | @"SixthViewController", 61 | @"SeventhViewController", 62 | @"EighthViewController", 63 | @"NinthViewController", 64 | ]; 65 | } 66 | 67 | #pragma mark - LazyLoad 68 | - (NinaPagerView *)ninaPagerView { 69 | if (!_ninaPagerView) { 70 | NSArray *titleArray = [self ninaTitleArray]; 71 | NSArray *vcsArray = [self ninaVCsArray]; 72 | /** 73 | * 创建ninaPagerView,控制器第一次是根据您划的位置进行相应的添加的,类似网易新闻虎扑看球等的效果,后面再滑动到相应位置时不再重新添加,如果想刷新数据,您可以在相应的控制器里加入刷新功能。需要注意的是,在创建您的控制器时,设置的frame为FUll_CONTENT_HEIGHT,即全屏高减去导航栏高度,如果这个高度不是您想要的,您可以去在下面的frame自定义设置。 74 | * A tip you should know is that when init the VCs frames,the default frame i set is FUll_CONTENT_HEIGHT,it means fullscreen height - NavigationHeight - TabbarHeight.If the frame is not what you want,just set frame as you wish. 75 | */ 76 | CGRect pagerRect = CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_CONTENT_HEIGHT); 77 | _ninaPagerView = [[NinaPagerView alloc] initWithFrame:pagerRect WithTitles:titleArray WithObjects:vcsArray]; 78 | _ninaPagerView.ninaPagerStyles = NinaPagerStyleBottomLine; 79 | } 80 | return _ninaPagerView; 81 | } 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /Example/Example Styles/ShowMixtureStyleController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ShowMixtureStyleController.h 3 | // NinaPagerView 4 | // 5 | // Created by Jeff Zhao on 2017/4/18. 6 | // Copyright © 2017年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ShowMixtureStyleController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Example Styles/ShowMixtureStyleController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ShowMixtureStyleController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 2017/4/18. 6 | // Copyright © 2017年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ShowMixtureStyleController.h" 10 | #import "UIParameter.h" 11 | #import "NinaPagerView.h" 12 | #import "FirstViewController.h" 13 | #import "SecondViewController.h" 14 | #import "FirstTableView.h" 15 | #import "SecondTableView.h" 16 | #import "ForthCollectionView.h" 17 | #import "TopTabTestController.h" 18 | 19 | @interface ShowMixtureStyleController () 20 | @property (nonatomic, strong) NinaPagerView *ninaPagerView; 21 | @end 22 | 23 | @implementation ShowMixtureStyleController 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | self.title = @"ShowMixtureWithNormalStyle"; 28 | self.view.backgroundColor = [UIColor whiteColor]; 29 | [self.view addSubview:self.ninaPagerView]; 30 | //Reload Titles and Objects 31 | // [self performSelector:@selector(reloadTopTabAndScrollView) withObject:nil afterDelay:5.0]; 32 | } 33 | 34 | 35 | #pragma mark - NinaParaArrays 36 | - (NSArray *)ninaTitleArray { 37 | return @[ 38 | @"大连市", 39 | @"甘井子", 40 | @"星海广场", 41 | @"西岗", 42 | @"马栏子", 43 | @"革镇堡", 44 | @"沙河口", 45 | @"人民广场", 46 | @"中山广场" 47 | ]; 48 | } 49 | 50 | /** 51 | * WithObjects传入方法3:适用于IB创建或者需要代码实例化创建的VC,如果您有此需求,请传入对应的VC即可,具体实现可参照下方代码。 52 | * If you think vcs is not comfortable for your project, you can use view arrays to built.Just put views into array. 53 | * 54 | * @return Array of views or controllers 55 | */ 56 | - (NSArray *)ninaDetailVCsArray { 57 | //Test init views and viewcontrollers,support creating views or viewcontroller by xib. 58 | TopTabTestController *firstVC = [TopTabTestController new]; 59 | firstVC.upScrollDelegate = self; 60 | SecondViewController *secondVC = [SecondViewController new]; 61 | FirstTableView *firstTV = [[FirstTableView alloc] initWithFrame:CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_VIEW_HEIGHT) style:UITableViewStylePlain]; 62 | UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 63 | layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; 64 | layout.minimumInteritemSpacing = 0; 65 | layout.minimumLineSpacing = 0; 66 | ForthCollectionView *forthCollectionView = [[ForthCollectionView alloc] initWithFrame:CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_CONTENT_HEIGHT) collectionViewLayout:layout]; 67 | UIStoryboard *FifthStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 68 | ChildBaseViewController *fifthVC = [FifthStory instantiateViewControllerWithIdentifier:@"111"]; 69 | UIStoryboard *sixthStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 70 | ChildBaseViewController *sixthVC = [sixthStory instantiateViewControllerWithIdentifier:@"222"]; 71 | UIStoryboard *seventhStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 72 | ChildBaseViewController *seventhVC = [seventhStory instantiateViewControllerWithIdentifier:@"333"]; 73 | UIStoryboard *eighthStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 74 | ChildBaseViewController *eighthVC = [eighthStory instantiateViewControllerWithIdentifier:@"444"]; 75 | UIStoryboard *ninthStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 76 | ChildBaseViewController *ninthVC = [ninthStory instantiateViewControllerWithIdentifier:@"555"]; 77 | return @[ 78 | firstVC, 79 | secondVC, 80 | firstTV, 81 | forthCollectionView, 82 | fifthVC, 83 | sixthVC, 84 | seventhVC, 85 | eighthVC, 86 | ninthVC 87 | ]; 88 | } 89 | 90 | #pragma mark - ScrollHiddenDelegate 91 | - (void)upScrollAction:(BOOL)show { 92 | //If you wanna to make toptab hidden or show,you can try following codes and choose detailVCsArray(Line 39) as your default vcs array: 93 | // self.ninaPagerView.topTabScrollHidden = show?NO:YES; 94 | } 95 | 96 | #pragma mark - LazyLoad 97 | - (NinaPagerView *)ninaPagerView { 98 | if (!_ninaPagerView) { 99 | NSArray *titleArray = [self ninaTitleArray]; 100 | NSArray *vcsArray = [self ninaDetailVCsArray]; 101 | CGRect pagerRect = CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_CONTENT_HEIGHT); 102 | _ninaPagerView = [[NinaPagerView alloc] initWithFrame:pagerRect WithTitles:titleArray WithObjects:vcsArray]; 103 | _ninaPagerView.ninaPagerStyles = NinaPagerStyleStateNormal; 104 | } 105 | return _ninaPagerView; 106 | } 107 | 108 | #pragma mark - Reload Titles and Objects 109 | - (void)reloadTopTabAndScrollView { 110 | [self.ninaPagerView reloadTopTabByTitles:[self ninasTitleArray] WithObjects:[self ninasVCsArray]]; 111 | } 112 | 113 | - (NSArray *)ninasTitleArray { 114 | return @[ 115 | @"大连市", 116 | @"甘井子", 117 | @"星海广场", 118 | ]; 119 | } 120 | 121 | - (NSArray *)ninasVCsArray { 122 | UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; 123 | layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; 124 | layout.minimumInteritemSpacing = 0; 125 | layout.minimumLineSpacing = 0; 126 | ForthCollectionView *forthCollectionView = [[ForthCollectionView alloc] initWithFrame:CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_CONTENT_HEIGHT) collectionViewLayout:layout]; 127 | UIStoryboard *FifthStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 128 | ChildBaseViewController *fifthVC = [FifthStory instantiateViewControllerWithIdentifier:@"111"]; 129 | UIStoryboard *sixthStory = [UIStoryboard storyboardWithName:@"NinaXibVC" bundle:nil]; 130 | ChildBaseViewController *sixthVC = [sixthStory instantiateViewControllerWithIdentifier:@"222"]; 131 | return @[ 132 | forthCollectionView, 133 | fifthVC, 134 | sixthVC, 135 | ]; 136 | } 137 | 138 | @end 139 | -------------------------------------------------------------------------------- /Example/Example Styles/ShowViewsStyleController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ShowViewsStyleController.h 3 | // NinaPagerView 4 | // 5 | // Created by Jeff Zhao on 2017/4/18. 6 | // Copyright © 2017年 赵富阳. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ShowViewsStyleController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Example Styles/ShowViewsStyleController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ShowViewsStyleController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 2017/4/18. 6 | // Copyright © 2017年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ShowViewsStyleController.h" 10 | #import "UIParameter.h" 11 | #import "NinaPagerView.h" 12 | 13 | @interface ShowViewsStyleController () 14 | @property (nonatomic, strong) NinaPagerView *ninaPagerView; 15 | @end 16 | 17 | @implementation ShowViewsStyleController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | self.title = @"ShowViewsWithSlideBlockStyle"; 22 | self.view.backgroundColor = [UIColor whiteColor]; 23 | [self.view addSubview:self.ninaPagerView]; 24 | } 25 | 26 | #pragma mark - NinaParaArrays 27 | - (NSArray *)ninaTitleArray { 28 | return @[ 29 | @"大连市", 30 | @"甘井子", 31 | @"星海广场", 32 | @"西岗", 33 | @"马栏子", 34 | @"革镇堡", 35 | @"沙河口", 36 | @"人民广场", 37 | @"中山广场" 38 | ]; 39 | } 40 | 41 | - (NSArray *)ninaViewsArray { 42 | return @[ 43 | @"FirstTableView", 44 | @"SecondTableView", 45 | @"ThirdTableView", 46 | @"FirstTableView", 47 | @"SecondTableView", 48 | @"ThirdTableView", 49 | @"FirstTableView", 50 | @"SecondTableView", 51 | @"ThirdTableView", 52 | ]; 53 | } 54 | 55 | #pragma mark - LazyLoad 56 | - (NinaPagerView *)ninaPagerView { 57 | if (!_ninaPagerView) { 58 | NSArray *titleArray = [self ninaTitleArray]; 59 | NSArray *vcsArray = [self ninaViewsArray]; 60 | CGRect pagerRect = CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_CONTENT_HEIGHT); 61 | _ninaPagerView = [[NinaPagerView alloc] initWithFrame:pagerRect WithTitles:titleArray WithObjects:vcsArray]; 62 | _ninaPagerView.ninaPagerStyles = NinaPagerStyleSlideBlock; 63 | } 64 | return _ninaPagerView; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Example/Gifs/NinaPagerViewGif1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Gifs/NinaPagerViewGif1.gif -------------------------------------------------------------------------------- /Example/Gifs/NinaPagerViewGif2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Gifs/NinaPagerViewGif2.gif -------------------------------------------------------------------------------- /Example/Gifs/NinaPagerViewGif3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Gifs/NinaPagerViewGif3.gif -------------------------------------------------------------------------------- /Example/Gifs/NinaPagerViewGif4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Gifs/NinaPagerViewGif4.gif -------------------------------------------------------------------------------- /Example/Gifs/NinaPagerViewGif5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Gifs/NinaPagerViewGif5.gif -------------------------------------------------------------------------------- /Example/Gifs/Slice1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Gifs/Slice1.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "size" : "29x29", 15 | "idiom" : "iphone", 16 | "filename" : "Icon-Small.png", 17 | "scale" : "1x" 18 | }, 19 | { 20 | "size" : "29x29", 21 | "idiom" : "iphone", 22 | "filename" : "Icon-Small@2x.png", 23 | "scale" : "2x" 24 | }, 25 | { 26 | "size" : "29x29", 27 | "idiom" : "iphone", 28 | "filename" : "Icon-Small@3x.png", 29 | "scale" : "3x" 30 | }, 31 | { 32 | "size" : "40x40", 33 | "idiom" : "iphone", 34 | "filename" : "Icon-40@2x.png", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "size" : "40x40", 39 | "idiom" : "iphone", 40 | "filename" : "Icon-40@3x.png", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "size" : "57x57", 45 | "idiom" : "iphone", 46 | "filename" : "Icon.png", 47 | "scale" : "1x" 48 | }, 49 | { 50 | "size" : "57x57", 51 | "idiom" : "iphone", 52 | "filename" : "Icon@2x.png", 53 | "scale" : "2x" 54 | }, 55 | { 56 | "size" : "60x60", 57 | "idiom" : "iphone", 58 | "filename" : "Icon-60@2x.png", 59 | "scale" : "2x" 60 | }, 61 | { 62 | "size" : "60x60", 63 | "idiom" : "iphone", 64 | "filename" : "Icon-60@3x.png", 65 | "scale" : "3x" 66 | }, 67 | { 68 | "idiom" : "ipad", 69 | "size" : "20x20", 70 | "scale" : "1x" 71 | }, 72 | { 73 | "idiom" : "ipad", 74 | "size" : "20x20", 75 | "scale" : "2x" 76 | }, 77 | { 78 | "size" : "29x29", 79 | "idiom" : "ipad", 80 | "filename" : "Icon-Small.png", 81 | "scale" : "1x" 82 | }, 83 | { 84 | "size" : "29x29", 85 | "idiom" : "ipad", 86 | "filename" : "Icon-Small@2x.png", 87 | "scale" : "2x" 88 | }, 89 | { 90 | "size" : "40x40", 91 | "idiom" : "ipad", 92 | "filename" : "Icon-40.png", 93 | "scale" : "1x" 94 | }, 95 | { 96 | "size" : "40x40", 97 | "idiom" : "ipad", 98 | "filename" : "Icon-40@2x.png", 99 | "scale" : "2x" 100 | }, 101 | { 102 | "size" : "50x50", 103 | "idiom" : "ipad", 104 | "filename" : "Icon-Small-50.png", 105 | "scale" : "1x" 106 | }, 107 | { 108 | "size" : "50x50", 109 | "idiom" : "ipad", 110 | "filename" : "Icon-Small-50@2x.png", 111 | "scale" : "2x" 112 | }, 113 | { 114 | "size" : "72x72", 115 | "idiom" : "ipad", 116 | "filename" : "Icon-72.png", 117 | "scale" : "1x" 118 | }, 119 | { 120 | "size" : "72x72", 121 | "idiom" : "ipad", 122 | "filename" : "Icon-72@2x.png", 123 | "scale" : "2x" 124 | }, 125 | { 126 | "size" : "76x76", 127 | "idiom" : "ipad", 128 | "filename" : "Icon-76.png", 129 | "scale" : "1x" 130 | }, 131 | { 132 | "size" : "76x76", 133 | "idiom" : "ipad", 134 | "filename" : "Icon-76@2x.png", 135 | "scale" : "2x" 136 | }, 137 | { 138 | "size" : "83.5x83.5", 139 | "idiom" : "ipad", 140 | "filename" : "Icon-83.5@2x.png", 141 | "scale" : "2x" 142 | } 143 | ], 144 | "info" : { 145 | "version" : 1, 146 | "author" : "xcode" 147 | } 148 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-40.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-72.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-72@2x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-76.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-Small-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-Small-50.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-Small.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/AppIcon.appiconset/Icon@2x.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/bank.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "bank.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/bank.imageset/bank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/bank.imageset/bank.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/bank_un.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "bank_un.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/bank_un.imageset/bank_un.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/bank_un.imageset/bank_un.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/clock.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "clock.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/clock.imageset/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/clock.imageset/clock.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/clock_un.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "clock_un.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/clock_un.imageset/clock_un.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/clock_un.imageset/clock_un.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/cup.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "cup.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/cup.imageset/cup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/cup.imageset/cup.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/cup_un.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "cup_un.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/cup_un.imageset/cup_un.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/cup_un.imageset/cup_un.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/data.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "data.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/data.imageset/data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/data.imageset/data.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/data_un.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "data_un.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/data_un.imageset/data_un.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/data_un.imageset/data_un.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/display.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "display.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/display.imageset/display.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/display.imageset/display.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/display_un.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "display_un.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/display_un.imageset/display_un.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/display_un.imageset/display_un.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/heart.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "heart.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/heart.imageset/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/heart.imageset/heart.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/heart_un.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "heart_un.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/heart_un.imageset/heart_un.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/heart_un.imageset/heart_un.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/lab.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "lab.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/lab.imageset/lab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/lab.imageset/lab.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/lab_un.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "lab_un.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/lab_un.imageset/lab_un.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/lab_un.imageset/lab_un.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/like.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "like.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/like.imageset/like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/like.imageset/like.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/like_un.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "like_un.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/like_un.imageset/like_un.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/like_un.imageset/like_un.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/tv.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "tv.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/tv.imageset/tv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/tv.imageset/tv.png -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/tv_un.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "tv_un.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Example/Supporting Files/Assets.xcassets/tv_un.imageset/tv_un.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamWire/NinaPagerView/2603af8b3cb01f8dd87aba8aba3d748b212083e1/Example/Supporting Files/Assets.xcassets/tv_un.imageset/tv_un.png -------------------------------------------------------------------------------- /Example/Supporting Files/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.6.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/Supporting Files/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 32 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Example/Supporting Files/main.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // main.m 4 | // NinaPagerView 5 | // 6 | // Created by RamWire on 15/11/13. 7 | // Copyright © 2015年 RamWire. All rights reserved. 8 | // 9 | 10 | #import 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Example/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // NinaPagerView 4 | // 5 | // Created by RamWire on 15/11/13. 6 | // Copyright © 2015年 RamWire. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "UIParameter.h" 11 | #import "ShowControllersStyleController.h" 12 | #import "ShowViewsStyleController.h" 13 | #import "ShowMixtureStyleController.h" 14 | #import "CostomTopStyleController.h" 15 | #import "ReloadTabsObjectsController.h" 16 | 17 | #define CELL_IDENTIFIER @"cell" 18 | 19 | @interface ViewController() 20 | @property (nonatomic, strong) UITableView *ninaPagerStyleTV; 21 | @property (nonatomic, strong) NSArray *showTitlesArray; 22 | @end 23 | 24 | @implementation ViewController 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | self.title = @"NinaPagerView"; 29 | self.showTitlesArray = @[@"ShowControllersWithBottomLineStyle",@"ShowViewsWithSlideBlockStyle",@"ShowMixtureWithNormalStyle",@"CostomTopWithBottomLineStyle",@"ReloadTabsObjects"]; 30 | [self.view addSubview:self.ninaPagerStyleTV]; 31 | } 32 | 33 | #pragma mark - LazyLoad 34 | - (UITableView *)ninaPagerStyleTV { 35 | if (!_ninaPagerStyleTV) { 36 | _ninaPagerStyleTV = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, FUll_VIEW_WIDTH, FUll_CONTENT_HEIGHT) style:UITableViewStyleGrouped]; 37 | _ninaPagerStyleTV.separatorStyle = UITableViewCellSeparatorStyleNone; 38 | _ninaPagerStyleTV.delegate = self; 39 | _ninaPagerStyleTV.dataSource = self; 40 | if (@available(iOS 11.0, *)) { 41 | _ninaPagerStyleTV.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; 42 | } 43 | } 44 | return _ninaPagerStyleTV; 45 | } 46 | 47 | #pragma mark - UITableViewDataSource 48 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 49 | return self.showTitlesArray.count; 50 | } 51 | 52 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 53 | return 1; 54 | } 55 | 56 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 57 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CELL_IDENTIFIER]; 58 | if (cell == nil) { 59 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CELL_IDENTIFIER]; 60 | } 61 | cell.textLabel.text = self.showTitlesArray[indexPath.section]; 62 | return cell; 63 | } 64 | 65 | #pragma mark - UITableViewDelegate 66 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 67 | switch (indexPath.section) { 68 | case 0: { 69 | ShowControllersStyleController *showControllerVC = [ShowControllersStyleController new]; 70 | [self.navigationController pushViewController:showControllerVC animated:YES]; 71 | } 72 | break; 73 | case 1: { 74 | ShowViewsStyleController *showViewsVC = [ShowViewsStyleController new]; 75 | [self.navigationController pushViewController:showViewsVC animated:YES]; 76 | } 77 | break; 78 | case 2: { 79 | ShowMixtureStyleController *showMixtureVC = [ShowMixtureStyleController new]; 80 | [self.navigationController pushViewController:showMixtureVC animated:YES]; 81 | } 82 | break; 83 | case 3: { 84 | CostomTopStyleController *costomTopVC = [CostomTopStyleController new]; 85 | [self.navigationController pushViewController:costomTopVC animated:YES]; 86 | } 87 | break; 88 | case 4: { 89 | ReloadTabsObjectsController *reloadDataVC = [ReloadTabsObjectsController new]; 90 | [self.navigationController pushViewController:reloadDataVC animated:YES]; 91 | } 92 | break; 93 | default: 94 | break; 95 | } 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /Example/Xib/NinaXibVC.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NinaPagerView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'NinaPagerView' 3 | s.version = '1.6.3' 4 | s.license = 'MIT' 5 | s.platform = :ios, '7.0' 6 | s.summary = 'NinaPagerView is a low-coupling segment easy to page your controllers and views.' 7 | s.homepage = 'https://github.com/RamWire/NinaPagerView' 8 | s.author = { 'RamWire' => 'RamWire' } 9 | s.source = { :git => 'https://github.com/RamWire/NinaPagerView.git', :tag => s.version.to_s } 10 | s.source_files = 'NinaPagerView/**/*.{h,m}' 11 | s.framework = 'UIKit' 12 | s.requires_arc = true 13 | end 14 | -------------------------------------------------------------------------------- /NinaPagerView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NinaPagerView.xcodeproj/xcshareddata/xcschemes/NinaPagerView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /NinaPagerView.xcodeproj/xcuserdata/renrun.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /NinaPagerView.xcodeproj/xcuserdata/renrun.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | NinaPagerView.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | NinaPagerViewCarthage.xcscheme 13 | 14 | isShown 15 | 16 | orderHint 17 | 3 18 | 19 | 20 | SuppressBuildableAutocreation 21 | 22 | 768240991BF5D32700788E48 23 | 24 | primary 25 | 26 | 27 | 768240B21BF5D32700788E48 28 | 29 | primary 30 | 31 | 32 | 768240BD1BF5D32700788E48 33 | 34 | primary 35 | 36 | 37 | 76CEDF901CBF78790074765F 38 | 39 | primary 40 | 41 | 42 | 76CEDF991CBF787A0074765F 43 | 44 | primary 45 | 46 | 47 | 76CEDFB31CBF78C90074765F 48 | 49 | primary 50 | 51 | 52 | 76CEDFBC1CBF78C90074765F 53 | 54 | primary 55 | 56 | 57 | 76CEDFD51CBF79370074765F 58 | 59 | primary 60 | 61 | 62 | 76CEDFDE1CBF79370074765F 63 | 64 | primary 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /NinaPagerView.xcodeproj/xcuserdata/zhaofuyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /NinaPagerView.xcodeproj/xcuserdata/zhaofuyang.xcuserdatad/xcschemes/NinaPagerView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 53 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 71 | 72 | 73 | 74 | 84 | 86 | 92 | 93 | 94 | 95 | 96 | 97 | 103 | 105 | 111 | 112 | 113 | 114 | 116 | 117 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /NinaPagerView.xcodeproj/xcuserdata/zhaofuyang.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | NinaPagerView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 768240991BF5D32700788E48 16 | 17 | primary 18 | 19 | 20 | 768240B21BF5D32700788E48 21 | 22 | primary 23 | 24 | 25 | 768240BD1BF5D32700788E48 26 | 27 | primary 28 | 29 | 30 | 76CEDFD51CBF79370074765F 31 | 32 | primary 33 | 34 | 35 | 76CEDFDE1CBF79370074765F 36 | 37 | primary 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /NinaPagerView/NinaBaseView.h: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 RamWire ( https://github.com/RamWire ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import 24 | 25 | @interface NinaBaseView : UIView 26 | 27 | @property (strong, nonatomic) UIScrollView *scrollView; /**< 滑动视图 **/ 28 | @property (assign, nonatomic) NSInteger currentPage; /**< 页码 **/ 29 | @property (strong, nonatomic) UIScrollView *topTab; /**< 顶部tab **/ 30 | @property (strong, nonatomic) NSArray *titleArray; /**< 标题 **/ 31 | @property (strong, nonatomic) NSArray *topArray; /**< 未选中时顶部自定义视图 **/ 32 | @property (strong, nonatomic) NSArray *changeTopArray; /**< 选中时顶部自定义视图 **/ 33 | @property (assign, nonatomic) CGFloat titleScale; /**< 标题缩放比例 **/ 34 | @property (assign, nonatomic) NSInteger baseDefaultPage; /**< 设置默认加载的界面 **/ 35 | @property (assign, nonatomic) CGFloat blockHeight; /**< 滑块高度 **/ 36 | @property (assign, nonatomic) CGFloat bottomLinePer; /**< 下划线占比 **/ 37 | @property (assign, nonatomic) CGFloat bottomLineHeight; /**< 下划线高度 **/ 38 | @property (assign, nonatomic) CGFloat cornerRadiusRatio; /**< 滑块圆角 **/ 39 | @property (assign, nonatomic) CGFloat titlesFont; /**< 标题字体大小 **/ 40 | @property (assign, nonatomic) CGFloat topHeight; /**< TopTab高度 **/ 41 | @property (assign, nonatomic) BOOL topTabUnderLineHidden; /**< 是否显示下方的下划线 **/ 42 | @property (assign, nonatomic) BOOL slideEnabled; /**< 允许下方左右滑动 **/ 43 | @property (assign, nonatomic) BOOL autoFitTitleLine; /**< 下划线是否自适应标题宽度 **/ 44 | @property (assign, nonatomic) BOOL topTabHiddenEnable; /**< 是否允许下方滑动时候隐藏上方的toptab **/ 45 | @property (strong, nonatomic) UIColor *btnUnSelectColor; /**< 未选中的标题颜色 **/ 46 | @property (strong, nonatomic) UIColor *btnSelectColor; /**< 选中的标题颜色 **/ 47 | @property (strong, nonatomic) UIColor *underlineBlockColor; /**< 下划线或滑块颜色 **/ 48 | @property (strong, nonatomic) UIColor *topTabColor; /**< topTab背景颜色 **/ 49 | /** 50 | * Init Method. 51 | * 52 | * @param frame NinaBaseView frame. 53 | * @param topTabNum Toptab styles. 54 | * 55 | */ 56 | - (instancetype)initWithFrame:(CGRect)frame WithTopTabType:(NSInteger)topTabNum; 57 | 58 | 59 | /** 60 | * Reload toptab titles 61 | * 62 | @param newTitles new titles 63 | */ 64 | - (void)reloadTabItems:(NSArray *)newTitles; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /NinaPagerView/NinaBaseView.m: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 RamWire ( https://github.com/RamWire ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import "NinaBaseView.h" 24 | #import "UIParameter.h" 25 | 26 | @implementation NinaBaseView 27 | { 28 | UIView *lineBottom; 29 | UIView *topTabBottomLine; 30 | NSMutableArray *btnArray; 31 | NSMutableArray *topTabArray; 32 | NSMutableArray *bottomLineWidthArray; 33 | NSInteger topTabType; 34 | UIView *ninaMaskView; 35 | } 36 | 37 | - (instancetype)initWithFrame:(CGRect)frame WithTopTabType:(NSInteger)topTabNum 38 | { 39 | self = [super initWithFrame:frame]; 40 | topTabType = topTabNum; 41 | return self; 42 | } 43 | 44 | #pragma mark - SetMethod 45 | - (void)setTitleArray:(NSArray *)titleArray { 46 | _titleArray = titleArray; 47 | [self baseViewLoadData]; 48 | } 49 | 50 | - (void)setTopTabHiddenEnable:(BOOL)topTabHiddenEnable { 51 | _topTabHiddenEnable = topTabHiddenEnable; 52 | CGFloat minusDistance = _topTabHiddenEnable?_topHeight:0; 53 | [UIView animateWithDuration:0.3 animations:^{ 54 | self.topTab.frame = CGRectMake(0, 0 - minusDistance, FUll_VIEW_WIDTH, _topHeight); 55 | self.scrollView.frame = CGRectMake(0, _topHeight - minusDistance, FUll_VIEW_WIDTH, self.frame.size.height - (_topHeight - minusDistance)); 56 | }]; 57 | } 58 | 59 | - (void)reloadTabItems:(NSArray *)newTitles { 60 | self.titleArray = newTitles; 61 | for (UIView *subView in self.topTab.subviews) { 62 | [subView removeFromSuperview]; 63 | } 64 | _scrollView.contentOffset = CGPointMake(0, 0); 65 | _topTab.contentOffset = CGPointMake(0, 0); 66 | [self updateScrollViewUI]; 67 | [self updateTopTabUI]; 68 | [self initUI]; 69 | } 70 | 71 | #pragma mark - LazyLoad 72 | - (UIScrollView *)scrollView { 73 | if (!_scrollView) { 74 | _scrollView = [[UIScrollView alloc] init]; 75 | _scrollView.delegate = self; 76 | _scrollView.tag = 318; 77 | _scrollView.backgroundColor = UIColorFromRGB(0xfafafa); 78 | [self updateScrollViewUI]; 79 | _scrollView.pagingEnabled = YES; 80 | _scrollView.showsHorizontalScrollIndicator = NO; 81 | _scrollView.alwaysBounceHorizontal = YES; 82 | _scrollView.scrollsToTop = NO; 83 | _scrollView.bounces = NO; 84 | if (@available(iOS 11.0, *)) { 85 | _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; 86 | } 87 | } 88 | return _scrollView; 89 | } 90 | 91 | - (UIScrollView *)topTab { 92 | if (!_topTab) { 93 | _topTab = [[UIScrollView alloc] init]; 94 | _topTab.delegate = self; 95 | if (_topTabColor) { 96 | _topTab.backgroundColor = _topTabColor; 97 | }else { 98 | _topTab.backgroundColor = [UIColor whiteColor]; 99 | } 100 | _topTab.tag = 917; 101 | _topTab.scrollEnabled = YES; 102 | _topTab.alwaysBounceHorizontal = YES; 103 | _topTab.showsHorizontalScrollIndicator = NO; 104 | _topTab.showsVerticalScrollIndicator = NO; 105 | _topTab.bounces = NO; 106 | _topTab.scrollsToTop = NO; 107 | [self updateTopTabUI]; 108 | if (@available(iOS 11.0, *)) { 109 | _topTab.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; 110 | } 111 | } 112 | return _topTab; 113 | } 114 | 115 | #pragma mark - BtnMethod 116 | - (void)touchAction:(UIButton *)button { 117 | [_scrollView setContentOffset:CGPointMake(FUll_VIEW_WIDTH * button.tag, 0) animated:YES]; 118 | self.currentPage = (FUll_VIEW_WIDTH * button.tag + FUll_VIEW_WIDTH / 2) / FUll_VIEW_WIDTH; 119 | } 120 | 121 | #pragma mark - UIScrollViewDelegate 122 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { 123 | if (scrollView.tag == 318) { 124 | self.currentPage = (NSInteger)((scrollView.contentOffset.x + FUll_VIEW_WIDTH / 2) / FUll_VIEW_WIDTH); 125 | } 126 | } 127 | 128 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 129 | if (scrollView.tag == 318) { 130 | NSInteger yourPage = (NSInteger)((scrollView.contentOffset.x + FUll_VIEW_WIDTH / 2) / FUll_VIEW_WIDTH); 131 | CGFloat yourCount = 1.0 / _titleArray.count; 132 | if (_titleArray.count > 5) { 133 | yourCount = 1.0 / 5.0; 134 | } 135 | if (_autoFitTitleLine) { 136 | _bottomLinePer = [bottomLineWidthArray[yourPage] floatValue] / (FUll_VIEW_WIDTH * yourCount); 137 | } 138 | CGFloat lineBottomDis = yourCount * FUll_VIEW_WIDTH * (1 -_bottomLinePer) / 2; 139 | if (topTabType == 1) { 140 | CGPoint maskCenter = ninaMaskView.center; 141 | if (_titleArray.count >= 5) { 142 | maskCenter.x = ninaMaskView.frame.size.width / 2.0 - (scrollView.contentOffset.x * 0.2); 143 | }else { 144 | maskCenter.x = ninaMaskView.frame.size.width / 2.0 - (scrollView.contentOffset.x * yourCount); 145 | } 146 | ninaMaskView.center = maskCenter; 147 | } 148 | if (_titleArray.count > 5) { 149 | switch (topTabType) { 150 | case 0: 151 | if (_bottomLineHeight >= 3) { 152 | lineBottom.frame = CGRectMake(scrollView.contentOffset.x / 5 + lineBottomDis, _topHeight - 3, yourCount * FUll_VIEW_WIDTH * _bottomLinePer, 3); 153 | break; 154 | } 155 | lineBottom.frame = CGRectMake(scrollView.contentOffset.x / 5 + lineBottomDis, _topHeight - _bottomLineHeight, yourCount * FUll_VIEW_WIDTH * _bottomLinePer, _bottomLineHeight); 156 | break; 157 | case 1: 158 | lineBottom.frame = CGRectMake(scrollView.contentOffset.x / 5 + lineBottomDis, (_topHeight - _blockHeight) / 2.0, yourCount * FUll_VIEW_WIDTH * _bottomLinePer, _blockHeight); 159 | break; 160 | default: 161 | break; 162 | } 163 | }else { 164 | switch (topTabType) { 165 | case 0: 166 | if (_bottomLineHeight >= 3) { 167 | lineBottom.frame = CGRectMake(scrollView.contentOffset.x / _titleArray.count + lineBottomDis, _topHeight - 3, yourCount * FUll_VIEW_WIDTH * _bottomLinePer, 3); 168 | }else { 169 | lineBottom.frame = CGRectMake(scrollView.contentOffset.x / _titleArray.count + lineBottomDis, _topHeight - _bottomLineHeight, yourCount * FUll_VIEW_WIDTH * _bottomLinePer, _bottomLineHeight); 170 | } 171 | break; 172 | case 1: 173 | lineBottom.frame = CGRectMake(scrollView.contentOffset.x / _titleArray.count + lineBottomDis, (_topHeight - _blockHeight) / 2.0, yourCount * FUll_VIEW_WIDTH * _bottomLinePer, _blockHeight); 174 | break; 175 | default: 176 | break; 177 | } 178 | } 179 | for (NSInteger i = 0; i < btnArray.count; i++) { 180 | if (topTabType == 0 || topTabType == 2) { 181 | if (_btnUnSelectColor) { 182 | [btnArray[i] setTitleColor:_btnUnSelectColor forState:UIControlStateNormal]; 183 | }else { 184 | [btnArray[i] setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; 185 | } 186 | if (_topArray.count == _titleArray.count && _changeTopArray.count == _titleArray.count && (topTabType == 0 || topTabType == 2)) { 187 | UIView *customTopView = _topArray[i]; 188 | UIButton *customTopButton = btnArray[i]; 189 | for (NSInteger i = [customTopButton.subviews count] - 1; i>=0; i--) { 190 | if ([[customTopButton.subviews objectAtIndex:i] isKindOfClass:[UIView class]]) { 191 | [[customTopButton.subviews objectAtIndex:i] removeFromSuperview]; 192 | } 193 | } 194 | customTopView.frame = customTopButton.bounds; 195 | customTopView.userInteractionEnabled = NO; 196 | customTopView.exclusiveTouch = NO; 197 | [customTopButton addSubview:customTopView]; 198 | } 199 | } 200 | UIButton *changeButton = btnArray[i]; 201 | [UIView animateWithDuration:0.3 animations:^{ 202 | changeButton.transform = CGAffineTransformMakeScale(1, 1); 203 | }]; 204 | } 205 | if (topTabType == 0 || topTabType == 2) { 206 | if (_btnSelectColor) { 207 | [btnArray[yourPage] setTitleColor:_btnSelectColor forState:UIControlStateNormal]; 208 | }else { 209 | [btnArray[yourPage] setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 210 | } 211 | if (_topArray.count == _titleArray.count && _changeTopArray.count == _titleArray.count) { 212 | UIButton *customTopButton = btnArray[yourPage]; 213 | for (NSInteger i = [customTopButton.subviews count] - 1; i>=0; i--) { 214 | if ([[customTopButton.subviews objectAtIndex:i] isKindOfClass:[UIView class]]) { 215 | [[customTopButton.subviews objectAtIndex:i] removeFromSuperview]; 216 | } 217 | } 218 | if (![customTopButton.subviews isKindOfClass:[UIView class]]) { 219 | UIView *whites = _changeTopArray[yourPage]; 220 | whites.frame = customTopButton.bounds; 221 | whites.userInteractionEnabled = NO; 222 | whites.exclusiveTouch = NO; 223 | [btnArray[yourPage] addSubview:whites]; 224 | } 225 | } 226 | UIButton *changeButton = btnArray[yourPage]; 227 | if (_titleScale > 0) { 228 | [UIView animateWithDuration:0.3 animations:^{ 229 | changeButton.transform = CGAffineTransformMakeScale(_titleScale, _titleScale); 230 | }]; 231 | }else { 232 | [UIView animateWithDuration:0.3 animations:^{ 233 | changeButton.transform = CGAffineTransformMakeScale(1.15, 1.15); 234 | }]; 235 | } 236 | } 237 | } 238 | } 239 | 240 | #pragma mark - Load scrollview and toptab 241 | - (void)updateScrollViewUI { 242 | _scrollView.contentSize = CGSizeMake(FUll_VIEW_WIDTH * _titleArray.count, 0); 243 | if (!_slideEnabled) { 244 | _scrollView.scrollEnabled = NO; 245 | } 246 | } 247 | 248 | - (void)updateTopTabUI { 249 | CGFloat additionCount = 0; 250 | if (_titleArray.count > 5) { 251 | additionCount = (_titleArray.count - 5.0) / 5.0; 252 | } 253 | _topTab.contentSize = CGSizeMake((1 + additionCount) * FUll_VIEW_WIDTH, _topHeight - TabbarHeight); 254 | if (_baseDefaultPage > 2 && _baseDefaultPage < _titleArray.count) { 255 | if (_titleArray.count >= 5) { 256 | _topTab.contentOffset = CGPointMake(1.0 / 5.0 * FUll_VIEW_WIDTH * (_baseDefaultPage - 2), 0); 257 | }else { 258 | _topTab.contentOffset = CGPointMake(1.0 / _titleArray.count * FUll_VIEW_WIDTH * (_baseDefaultPage - 2), 0); 259 | } 260 | } 261 | btnArray = [NSMutableArray array]; 262 | bottomLineWidthArray = [NSMutableArray array]; 263 | topTabArray = [NSMutableArray array]; 264 | for (NSInteger i = 0; i < _titleArray.count; i++) { 265 | UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 266 | button.tag = i; 267 | if (_titleArray.count > 5) { 268 | button.frame = CGRectMake(More5LineWidth * i, 0, More5LineWidth, _topHeight); 269 | }else { 270 | button.frame = CGRectMake(FUll_VIEW_WIDTH / _titleArray.count * i, 0, FUll_VIEW_WIDTH / _titleArray.count, _topHeight); 271 | } 272 | if (_topArray.count == _titleArray.count && _changeTopArray.count == _titleArray.count && (topTabType == 0 || topTabType == 2)) { 273 | UIView *customTopView = _topArray[i]; 274 | customTopView.frame = button.bounds; 275 | customTopView.userInteractionEnabled = NO; 276 | customTopView.exclusiveTouch = NO; 277 | [topTabArray addObject:customTopView]; 278 | [button addSubview:customTopView]; 279 | }else { 280 | button.titleLabel.font = [UIFont systemFontOfSize:_titlesFont]; 281 | if ([_titleArray[i] isKindOfClass:[NSString class]]) { 282 | [bottomLineWidthArray addObject:[NSString stringWithFormat:@"%f",[_titleArray[i] sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:_titlesFont]}].width]]; 283 | [button setTitle:_titleArray[i] forState:UIControlStateNormal]; 284 | button.titleLabel.numberOfLines = 0; 285 | button.titleLabel.textAlignment = NSTextAlignmentCenter; 286 | }else { 287 | NSLog(@"Your title%li not fit for topTab,please correct it to NSString!",(long)i + 1); 288 | } 289 | } 290 | [_topTab addSubview:button]; 291 | [button addTarget:self action:@selector(touchAction:) forControlEvents:UIControlEventTouchUpInside]; 292 | [btnArray addObject:button]; 293 | if (i == 0 && (topTabType == 0 || topTabType == 2)) { 294 | if (_btnSelectColor) { 295 | [button setTitleColor:_btnSelectColor forState:UIControlStateNormal]; 296 | }else { 297 | [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 298 | } 299 | if (_titleScale > 0) { 300 | button.transform = CGAffineTransformMakeScale(_titleScale, _titleScale); 301 | } 302 | if (_topArray.count == _titleArray.count && _changeTopArray.count == _titleArray.count) { 303 | for (NSInteger i = [button.subviews count] - 1; i >= 0; i--) { 304 | if ([[button.subviews objectAtIndex:i] isKindOfClass:[UIView class]]) { 305 | [[button.subviews objectAtIndex:i] removeFromSuperview]; 306 | } 307 | } 308 | if (![button.subviews isKindOfClass:[UIView class]]) { 309 | UIView *whites = _changeTopArray[0]; 310 | whites.frame = button.bounds; 311 | whites.userInteractionEnabled = NO; 312 | whites.exclusiveTouch = NO; 313 | [btnArray[0] addSubview:whites]; 314 | } 315 | } 316 | } else { 317 | if (_btnUnSelectColor) { 318 | [button setTitleColor:_btnUnSelectColor forState:UIControlStateNormal]; 319 | }else { 320 | [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; 321 | } 322 | } 323 | } 324 | //Create Toptab underline. 325 | if (!_topTabUnderLineHidden) { 326 | topTabBottomLine = [UIView new]; 327 | topTabBottomLine.backgroundColor = UIColorFromRGB(0xcecece); 328 | [_topTab addSubview:topTabBottomLine]; 329 | } 330 | //Create Toptab bottomline. 331 | lineBottom = [UIView new]; 332 | if (_underlineBlockColor) { 333 | lineBottom.backgroundColor = _underlineBlockColor; 334 | }else { 335 | lineBottom.backgroundColor = UIColorFromRGB(0xff6262); 336 | } 337 | lineBottom.clipsToBounds = YES; 338 | lineBottom.userInteractionEnabled = YES; 339 | [_topTab addSubview:lineBottom]; 340 | //Create ninaMaskView. 341 | if (topTabType == 1) { 342 | ninaMaskView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, (1 + additionCount) * FUll_VIEW_WIDTH, _blockHeight)]; 343 | ninaMaskView.backgroundColor = [UIColor clearColor]; 344 | for (NSInteger j = 0; j < _titleArray.count; j++) { 345 | UILabel *maskLabel = [UILabel new]; 346 | if (_titleArray.count > 5) { 347 | maskLabel.frame = CGRectMake(More5LineWidth * j - More5LineWidth * (1 - _bottomLinePer) / 2, 0, More5LineWidth, _blockHeight); 348 | }else { 349 | maskLabel.frame = CGRectMake(FUll_VIEW_WIDTH / _titleArray.count * j - FUll_VIEW_WIDTH / _titleArray.count * (1 - _bottomLinePer) / 2, 0, FUll_VIEW_WIDTH / _titleArray.count, _blockHeight); 350 | } 351 | maskLabel.text = _titleArray[j]; 352 | maskLabel.textColor = _btnSelectColor?_btnSelectColor:[UIColor whiteColor]; 353 | maskLabel.numberOfLines = 0; 354 | maskLabel.textAlignment = NSTextAlignmentCenter; 355 | maskLabel.font = [UIFont systemFontOfSize:_titlesFont]; 356 | [ninaMaskView addSubview:maskLabel]; 357 | } 358 | [lineBottom addSubview:ninaMaskView]; 359 | } 360 | if (topTabType == 2) { 361 | lineBottom.hidden = YES; 362 | } 363 | } 364 | 365 | #pragma mark - LoadData 366 | - (void)baseViewLoadData { 367 | self.topTab.frame = CGRectMake(0, 0, FUll_VIEW_WIDTH, _topHeight); 368 | self.scrollView.frame = CGRectMake(0, _topHeight, FUll_VIEW_WIDTH, self.frame.size.height - _topHeight); 369 | [self addSubview:self.topTab]; 370 | [self addSubview:self.scrollView]; 371 | [self initUI]; 372 | } 373 | 374 | - (void)initUI { 375 | CGFloat yourCount = 1.0 / _titleArray.count; 376 | CGFloat additionCount = 0; 377 | if (_titleArray.count > 5) { 378 | additionCount = (_titleArray.count - 5.0) / 5.0; 379 | yourCount = 1.0 / 5.0; 380 | } 381 | if (_autoFitTitleLine) { 382 | _bottomLinePer = [bottomLineWidthArray[0] floatValue] / (FUll_VIEW_WIDTH * yourCount); 383 | } 384 | CGFloat lineBottomDis = yourCount * FUll_VIEW_WIDTH * (1 -_bottomLinePer) / 2; 385 | NSInteger defaultPage = (_baseDefaultPage > 0 && _baseDefaultPage < _titleArray.count)?_baseDefaultPage:0; 386 | switch (topTabType) { 387 | case 0: 388 | if (_bottomLineHeight >= 3) { 389 | lineBottom.frame = CGRectMake(lineBottomDis, _topHeight - 3, yourCount * FUll_VIEW_WIDTH * _bottomLinePer, 3); 390 | }else { 391 | lineBottom.frame = CGRectMake(lineBottomDis + FUll_VIEW_WIDTH * yourCount * defaultPage, _topHeight - _bottomLineHeight, yourCount * FUll_VIEW_WIDTH * _bottomLinePer, _bottomLineHeight); 392 | } 393 | break; 394 | case 1: { 395 | lineBottom.frame = CGRectMake(lineBottomDis + FUll_VIEW_WIDTH * yourCount * defaultPage, (_topHeight - _blockHeight) / 2.0, yourCount * FUll_VIEW_WIDTH * _bottomLinePer, _blockHeight); 396 | if (_cornerRadiusRatio > 0) { 397 | lineBottom.layer.cornerRadius = _blockHeight / _cornerRadiusRatio; 398 | } 399 | } 400 | break; 401 | default: 402 | break; 403 | } 404 | if (!_topTabUnderLineHidden) { 405 | topTabBottomLine.frame = CGRectMake(0, _topHeight - 1, (1 + additionCount) * FUll_VIEW_WIDTH, 1); 406 | } 407 | } 408 | 409 | @end 410 | -------------------------------------------------------------------------------- /NinaPagerView/NinaPagerView.h: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 RamWire ( https://github.com/RamWire ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import 24 | 25 | typedef NS_ENUM(NSInteger, NinaPagerStyle) { 26 | /**< 上侧为下划线 **/ 27 | NinaPagerStyleBottomLine = 0, //Default style 28 | /**< 上侧为滑块 **/ 29 | NinaPagerStyleSlideBlock = 1, 30 | /**< 上侧只有文字颜色变化(没有下划线或滑块) **/ 31 | NinaPagerStyleStateNormal = 2, 32 | }; 33 | 34 | @protocol NinaPagerViewDelegate 35 | @optional 36 | /** 37 | * 如果您觉得创建的控制器(0.7:只适用于控制器情况)过多(>5)占用内存过大,可以尝试此代理方法,默认只保留5个最近滑到的控制器,剩下的控制器将被释放,直到您再滑到相应位置才会被重新加载,如果不执行此代理,则默认为不释放。 38 | * If you care the vcs causes huge memory,please try this delegate,default is load recent 5 vcs,others will dealloc.If you scroll to the dealloc page, it will load again.If you don't use the delegate,default is NO. 39 | * 40 | * @return If YES,just keep recent five views or controllers,dealloc others,init them again when needed.If NO,keep all. 41 | */ 42 | - (BOOL)deallocVCsIfUnnecessary; 43 | /** 44 | * 通过此代理方法您可以获取到当前页码、当前对象及上一个对象进而对相关的控制器进行操作。 45 | * Get current page and objects by the delegate method, you can code here when you need it. 46 | * 47 | * @param currentPage Current page when you scroll to or choose the view or controller. 48 | * @param currentObject Current object that you scroll to. 49 | * @param lastObject Last object that you scroll to. 50 | */ 51 | - (void)ninaCurrentPageIndex:(NSInteger)currentPage currentObject:(id)currentObject lastObject:(id)lastObject; 52 | @end 53 | 54 | @interface NinaPagerView : UIView 55 | /** 56 | * NinaPagerView init method. 57 | * 58 | * @param frame NinaPagerView's frame. 59 | * @param titles Titles in Toptab. 60 | * @param objects Controllers,views or storyboards. 61 | * 62 | */ 63 | - (instancetype)initWithFrame:(CGRect)frame WithTitles:(NSArray *)titles WithObjects:(NSArray *)objects; 64 | 65 | 66 | /** 67 | * Reload NinaPagerView with updated titles and viewcontrollers or views. 68 | * 69 | @param updatedTitles update titles. 70 | @param updatedObjects update viewcontrollers,views and others. 71 | */ 72 | - (void)reloadTopTabByTitles:(NSArray *)updatedTitles WithObjects:(NSArray *)updatedObjects; 73 | 74 | /** 75 | * Reload NinaPagerView with updated titles. 76 | * Warning:Titles count must equal to the origin titles count. 77 | * 78 | @param updatedTitles update titles. 79 | */ 80 | - (void)reloadTopTabByTitles:(NSArray *)updatedTitles; 81 | 82 | /**< 83 | * 顶部菜单栏的展示样式。 84 | * The style of TopTab. 85 | **/ 86 | @property (assign, nonatomic) NinaPagerStyle ninaPagerStyles; 87 | /**< 88 | * 上方标题未选中时颜色,默认颜色为灰色。 89 | * The titles' color when not selected,default color is gray. 90 | **/ 91 | @property (strong, nonatomic) UIColor *unSelectTitleColor; 92 | /**< 93 | * 上方标题选中时颜色,默认颜色为黑色。 94 | * The titles' color when selected,default color is black. 95 | **/ 96 | @property (strong, nonatomic) UIColor *selectTitleColor; 97 | /**< 98 | * 在下划线模式下的下划线的颜色,默认十六进制颜色码为#ff6262。 99 | * Underline's color in NinaPagerStyleBottomLine mode,default color code is #ff6262. 100 | **/ 101 | @property (strong, nonatomic) UIColor *underlineColor; 102 | /**< 103 | * 在滑块模式下滑块颜色,默认十六进制颜色码为#ff6262。 104 | * SliderBlock's color in NinaPagerStyleSlideBlock mode,default color code is #ff6262. 105 | **/ 106 | @property (strong, nonatomic) UIColor *sliderBlockColor; 107 | /**< 108 | * 上方topTab背景颜色,默认颜色为白色。 109 | * TopTab's background colordefault color is white. 110 | **/ 111 | @property (strong, nonatomic) UIColor *topTabBackGroundColor; 112 | 113 | /**< 114 | * 所在的控制器index或点击上方button的index。 115 | * Current controller's or view's index and click button's index. 116 | **/ 117 | @property (assign, nonatomic) NSInteger pageIndex; 118 | /**< 119 | * 设置默认加载的界面,默认加载的界面是第一页,您可以选择要加载第几页的页面,不仅仅局限于第一页这样的展示方法,更加灵活。 120 | * Set default loading page,you can set this for index of your page.Not only loads first page,but also choose other pages as default page.More flexible. 121 | **/ 122 | @property (assign, nonatomic) NSInteger ninaDefaultPage; 123 | /**< 124 | * 动态跳转相应的tab界面。 125 | * Set index to move your chosen tab page. 126 | **/ 127 | @property (assign, nonatomic) NSInteger ninaChosenPage; 128 | /** 129 | * 上方TopTab的高度值,如果不设置默认值为40,请设置值大于25。 130 | * TopTab height,default height is 40,please set it above 25. 131 | */ 132 | @property (assign, nonatomic) CGFloat topTabHeight; 133 | /** 134 | * 上方标题的字体大小设置,默认为14。 135 | * Title font in TopTab,default font is 14. 136 | */ 137 | @property (assign, nonatomic) CGFloat titleFont; 138 | /** 139 | * 您可以设置titleSize这个属性来设置标题的缩放比例(相对于原比例标题)。同时,在加入了顶部自定义视图之后,您可以通过设置此属性来对选中的view整体进行缩放,推荐您设置的范围在1~1.5之间,如果不设置此属性,默认的缩放比例为1.15。(需要注意的是,此属性不适用于NinaPagerStyleSlideBlock样式) 140 | * You can set titleSize for title animation(compare to origin title).Meanwhile,after adding custom topTab,you also can set the property to the topTab view which selected.Command range between 1 and 1.5.If don't set this,default scale is 1.15.(TitleScale is not working on NinaPagerStyleSlideBlock) 141 | */ 142 | @property (assign, nonatomic) CGFloat titleScale; 143 | /**< 144 | * 您可以对此参数进行设置来改变下划线的长度,此参数代表的是选中的整体部分的占比,默认为1,您可以对此进行设置,但推荐您尽量不要设置在0.5以下(此参数设置在两种样式中均可使用)。 145 | * You can set this parameter to change the length of bottomline,the percent of selected button,default is 1.Recommand to set it above 0.5. 146 | **/ 147 | @property (assign, nonatomic) CGFloat selectBottomLinePer; 148 | /**< 149 | * 您可以对此参数进行设置来改变下划线的高度,默认为2,若超过3,则默认为3。 150 | * You can set this to change bottomline's height,default is 2,max height is 3. 151 | **/ 152 | @property (assign, nonatomic) CGFloat selectBottomLineHeight; 153 | /**< 154 | * NinaPagerStyleSlideBlock模式下的滑块高度。 155 | * SliderBlock's height in NinaPagerStyleSlideBlock. 156 | **/ 157 | @property (assign, nonatomic) CGFloat sliderHeight; 158 | /**< 159 | * 滑块的layer.cornerRadius属性,默认的计算公式是(滑块高度 / SlideBlockCornerRadius),若您想要自定义调整,请修改此参数,如果不想要圆角,请设置此参数为0。 160 | * Sliderblock's layer.cornerRadius,it equals to sliderHeight / SlideBlockCornerRadius,if you don't want cornerRadius,please set this to 0. 161 | **/ 162 | @property (assign, nonatomic) CGFloat sliderCornerRadiusRatio; 163 | /**< 164 | * 是否隐藏了导航栏,您的导航栏如果隐藏或者没有,需要将此属性设置为YES。 165 | * Hide NavigationBar or not,if you wanna set this to YES,you must hide your NavigationBar first. 166 | **/ 167 | @property (assign, nonatomic) BOOL nina_navigationBarHidden; 168 | /**< 169 | * 是否一次性加载全部页面或控制器,默认为否。 170 | * Load whole viewcontrollers or views,default is NO. 171 | **/ 172 | @property (assign, nonatomic) BOOL loadWholePages; 173 | /**< 174 | * 上方TopTab下面的总览线是否隐藏,默认为不隐藏。 175 | * Hide the topTab's underline(not the select underline) or not,default is NO. 176 | **/ 177 | @property (assign, nonatomic) BOOL underLineHidden; 178 | /**< 179 | * 允许下方视图进行左右滑动,默认为允许。 180 | * Able to scroll scrollview in main view,default is YES. 181 | **/ 182 | @property (assign, nonatomic) BOOL nina_scrollEnabled; 183 | /**< 184 | * 是否选择自适应下划线长度(与当前标题文字长度相同),默认为NO,如果设置了selectBottomLinePer属性,此属性将不起作用。 185 | * Auto-calculate bottomline's width,the same with current title's width,default is NO,if you set selectBottomLinePer,this property will not work. 186 | **/ 187 | @property (assign, nonatomic) BOOL nina_autoBottomLineEnable; 188 | /**< 189 | * 是否允许topTab根据下方视图上下滑动进行隐藏显示的功能,需要注意的是此属性必须跟您的子控制器或者子视图进行对应的显示或隐藏,您可以参考Example的TopTabTestController中设置来自定义,默认的隐藏显示动画时间为0.3秒。 190 | * Make topTab hidden when scrollview scrolling down.This property must be changed by your vcs or views.You can refer to detail codes in TopTabTestController,default animation duration is 0.3. 191 | **/ 192 | @property (assign, nonatomic) BOOL topTabScrollHidden; 193 | /**< 194 | * 自定义顶部栏视图,支持用户替代原有的固态标题样式。该属性是需要传入未选中(普通状态)时顶部样式,具体设置可参照Example中的方式(此自定义方式在NinaPagerStyleSlideBlock中并不适用)。 195 | * Custom topTab views,you can set views as you wish.The property needs to your unselected(normal) views array,you can set it like Example's setting(This property doesn't support NinaPagerStyleSlideBlock mode). 196 | **/ 197 | @property (strong, nonatomic) NSArray *topTabViews; 198 | /**< 199 | * 自定义顶部栏视图,支持用户替代原有的固态标题样式。该属性是需要传入选中时顶部样式,具体设置可参照Example中的方式(此自定义方式在NinaPagerStyleSlideBlock中并不适用)。 200 | * Custom topTab views,you can set views as you wish.The property needs to your selected views array,you can set it like Example's setting(This property doesn't support NinaPagerStyleSlideBlock mode). 201 | **/ 202 | @property (strong, nonatomic) NSArray *selectedTopTabViews; 203 | 204 | @property (weak, nonatomic) iddelegate; /**< NinaPagerView代理 **/ 205 | 206 | @end 207 | -------------------------------------------------------------------------------- /NinaPagerView/NinaPagerView.m: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 RamWire ( https://github.com/RamWire ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import "NinaPagerView.h" 24 | #import "UIParameter.h" 25 | #import "NinaBaseView.h" 26 | #import "UIView+ViewController.h" 27 | 28 | #define MaxNums 10 //Max limit number,recommand below 10. 29 | static NSString *const kObserverPage = @"currentPage"; 30 | 31 | @interface NinaPagerView() 32 | @property (nonatomic, strong) NSCache *limitControllerCache; 33 | @property (nonatomic, strong) NinaBaseView *ninaBaseView; 34 | @property (nonatomic, assign) BOOL hasSettingScrollEnabled; 35 | @property (nonatomic, assign) BOOL hasSettingLinePer; 36 | @property (nonatomic, strong) id currentObject; 37 | @property (nonatomic, strong) id lastObject; 38 | @end 39 | 40 | @implementation NinaPagerView 41 | { 42 | NSArray *titlesArray; 43 | NSArray *classArray; 44 | NSMutableArray *viewNumArray; 45 | NSMutableArray *vcsTagArray; 46 | NSMutableArray *vcsArray; 47 | BOOL viewAlloc[MaxNums]; 48 | UIViewController *firstVC; 49 | BOOL pagerLoadWhole; 50 | BOOL ableLoadData; 51 | } 52 | 53 | - (instancetype)initWithFrame:(CGRect)frame WithTitles:(NSArray *)titles WithObjects:(NSArray *)objects 54 | { 55 | if (self = [super init]) { 56 | self.frame = frame; 57 | titlesArray = titles; 58 | classArray = objects; 59 | } 60 | return self; 61 | } 62 | 63 | #pragma mark - SetMethod 64 | - (void)setNinaDefaultPage:(NSInteger)ninaDefaultPage { 65 | _ninaDefaultPage = ninaDefaultPage; 66 | _ninaDefaultPage = (_ninaDefaultPage > 0 && _ninaDefaultPage < titlesArray.count)?_ninaDefaultPage:0; 67 | } 68 | 69 | - (void)setNinaChosenPage:(NSInteger)ninaChosenPage { 70 | if (ninaChosenPage > titlesArray.count) { 71 | NSLog(@"You can't set chosen page greater than titles count!"); 72 | return; 73 | } 74 | self.ninaBaseView.scrollView.contentOffset = CGPointMake(FUll_VIEW_WIDTH * (ninaChosenPage - 1) - 1, 0); 75 | self.ninaBaseView.currentPage = ninaChosenPage - 1; 76 | } 77 | 78 | - (void)setSelectBottomLinePer:(CGFloat)selectBottomLinePer { 79 | _selectBottomLinePer = selectBottomLinePer; 80 | _hasSettingLinePer = YES; 81 | } 82 | 83 | - (void)setNina_scrollEnabled:(BOOL)nina_scrollEnabled { 84 | _nina_scrollEnabled = nina_scrollEnabled; 85 | _hasSettingScrollEnabled = YES; 86 | } 87 | 88 | - (void)setTopTabScrollHidden:(BOOL)topTabScrollHidden { 89 | _topTabScrollHidden = topTabScrollHidden; 90 | self.ninaBaseView.topTabHiddenEnable = _topTabScrollHidden; 91 | } 92 | 93 | #pragma mark - LazyLoad 94 | - (NinaBaseView *)ninaBaseView { 95 | if (!_ninaBaseView) { 96 | _ninaBaseView = [[NinaBaseView alloc] initWithFrame:self.bounds WithTopTabType:_ninaPagerStyles]; 97 | [_ninaBaseView addObserver:self forKeyPath:kObserverPage options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil]; 98 | } 99 | return _ninaBaseView; 100 | } 101 | 102 | #pragma mark - LayOutSubViews 103 | - (void)layoutSubviews { 104 | [super layoutSubviews]; 105 | if (!_ninaBaseView) { 106 | if (_topTabHeight <= 25) { 107 | _topTabHeight = 40; 108 | } 109 | [self loadDataForView]; 110 | } 111 | } 112 | 113 | #pragma mark - LoadData 114 | - (void)loadDataForView { 115 | [self createPagerView:titlesArray WithObjects:classArray]; 116 | self.ninaBaseView.btnUnSelectColor = _unSelectTitleColor; 117 | self.ninaBaseView.btnSelectColor = _selectTitleColor; 118 | self.ninaBaseView.underlineBlockColor = (_ninaPagerStyles == 1)?_sliderBlockColor:_underlineColor; 119 | self.ninaBaseView.topTabColor = _topTabBackGroundColor; 120 | CGFloat tabHeight = _topTabHeight > 25?_topTabHeight:40; 121 | self.ninaBaseView.topHeight = tabHeight; 122 | self.ninaBaseView.baseDefaultPage = _ninaDefaultPage; 123 | self.ninaBaseView.topArray = _topTabViews; 124 | self.ninaBaseView.changeTopArray = _selectedTopTabViews; 125 | self.ninaBaseView.titleScale = _titleScale > 0?_titleScale:1.15; 126 | self.ninaBaseView.titlesFont = _titleFont > 0?_titleFont:14; 127 | self.ninaBaseView.topTabUnderLineHidden = _underLineHidden; 128 | self.ninaBaseView.slideEnabled = _hasSettingScrollEnabled?_nina_scrollEnabled:YES; 129 | self.ninaBaseView.blockHeight = _sliderHeight > 0?_sliderHeight:tabHeight; 130 | self.ninaBaseView.bottomLinePer = (_selectBottomLinePer > 0 && _selectBottomLinePer < 1 && _hasSettingLinePer)?_selectBottomLinePer:1; 131 | self.ninaBaseView.autoFitTitleLine = (_nina_autoBottomLineEnable && !_hasSettingLinePer)?_nina_autoBottomLineEnable:NO; 132 | self.ninaBaseView.bottomLineHeight = _selectBottomLineHeight > 0?_selectBottomLineHeight:2; 133 | self.ninaBaseView.cornerRadiusRatio = _sliderCornerRadiusRatio > 0?_sliderCornerRadiusRatio:0; 134 | self.ninaBaseView.titleArray = titlesArray; 135 | if (_nina_navigationBarHidden == YES) { 136 | self.viewController.automaticallyAdjustsScrollViewInsets = NO; 137 | self.ninaBaseView.topTab.frame = CGRectMake(0, 20, FUll_VIEW_WIDTH, tabHeight); 138 | self.ninaBaseView.scrollView.frame = CGRectMake(0, tabHeight + 20, FUll_VIEW_WIDTH, self.frame.size.height - tabHeight); 139 | } 140 | if (_ninaDefaultPage > 0) { 141 | self.ninaBaseView.scrollView.contentOffset = CGPointMake(FUll_VIEW_WIDTH * _ninaDefaultPage, 0); 142 | } 143 | if (classArray.count > 0 && titlesArray.count > 0 && ableLoadData) { 144 | if (_loadWholePages) { 145 | for (NSInteger i = 0; i< classArray.count; i++) { 146 | [self loadWholeOrNotWithTag:i WithMode:1]; 147 | } 148 | }else { 149 | [self loadWholeOrNotWithTag:_ninaDefaultPage WithMode:0]; 150 | } 151 | } 152 | if (_loadWholePages) { 153 | for (NSInteger i = 0; i < vcsArray.count; i++) { 154 | [self.viewController addChildViewController:vcsArray[i]]; 155 | } 156 | }else { 157 | if (firstVC != nil) { 158 | [self.viewController addChildViewController:firstVC]; 159 | } 160 | } 161 | self.viewController.edgesForExtendedLayout = UIRectEdgeNone; 162 | } 163 | 164 | 165 | #pragma mark - Reload Data 166 | - (void)reloadTopTabByTitles:(NSArray *)updatedTitles WithObjects:(NSArray *)updatedObjects { 167 | titlesArray = updatedTitles; 168 | classArray = updatedObjects; 169 | if (firstVC) { 170 | [firstVC.view removeFromSuperview]; 171 | firstVC.view = nil; 172 | [firstVC removeFromParentViewController]; 173 | } 174 | for (UIViewController *subVC in self.viewController.childViewControllers) { 175 | [subVC.view removeFromSuperview]; 176 | subVC.view = nil; 177 | [subVC removeFromParentViewController]; 178 | } 179 | if (!_loadWholePages) { 180 | for (NSInteger i = 0; i < classArray.count; i++) { 181 | viewAlloc[i] = NO; 182 | } 183 | } 184 | [self loadDataForView]; 185 | [self.ninaBaseView reloadTabItems:updatedTitles]; 186 | } 187 | 188 | - (void)reloadTopTabByTitles:(NSArray *)updatedTitles { 189 | titlesArray = updatedTitles; 190 | [self.ninaBaseView reloadTabItems:updatedTitles]; 191 | } 192 | 193 | #pragma mark - NSCache 194 | - (NSCache *)limitControllerCache { 195 | if (!_limitControllerCache) { 196 | _limitControllerCache = [NSCache new]; 197 | _limitControllerCache.delegate = self; 198 | } 199 | /**< Set max of controller's number **/ 200 | _limitControllerCache.countLimit = 5; 201 | return _limitControllerCache; 202 | } 203 | 204 | #pragma mark - CreateView 205 | - (void)createPagerView:(NSArray *)titles WithObjects:(NSArray *)objects { 206 | viewNumArray = [NSMutableArray array]; 207 | vcsArray = [NSMutableArray array]; 208 | vcsTagArray = [NSMutableArray array]; 209 | if (titles.count > 0 && objects.count > 0) { 210 | [self addSubview:self.ninaBaseView]; 211 | //First ViewController present to the screen 212 | ableLoadData = YES; 213 | }else { 214 | NSLog(@"You should correct titlesArray or childVCs count!"); 215 | } 216 | } 217 | 218 | #pragma mark - KVO 219 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 220 | if (object == self.ninaBaseView && [keyPath isEqualToString:kObserverPage]) { 221 | NSInteger page = [change[@"new"] integerValue]; 222 | if (isDebugging) { 223 | NSLog(@"It's controller %li",(long)page + 1); 224 | } 225 | for (NSInteger i = 0; i < vcsTagArray.count; i++) { 226 | if ([vcsTagArray[i] isEqualToString:[NSString stringWithFormat:@"%i",[change[@"new"] intValue]]]) { 227 | self.lastObject = self.currentObject; 228 | self.currentObject = vcsArray[i]; 229 | if ([vcsArray[i] isKindOfClass:[UIViewController class]]) { 230 | [vcsArray[i] viewDidAppear:YES]; 231 | } 232 | } 233 | } 234 | self.pageIndex = page; 235 | [self performSelector:@selector(currentPageAndObject) withObject:nil afterDelay:0.1]; 236 | if (titlesArray.count > 5) { 237 | CGFloat topTabOffsetX = 0; 238 | if (page >= 2) { 239 | if (page <= titlesArray.count - 3) { 240 | topTabOffsetX = (page - 2) * More5LineWidth; 241 | } 242 | else { 243 | if (page == titlesArray.count - 2) { 244 | topTabOffsetX = (page - 3) * More5LineWidth; 245 | }else { 246 | topTabOffsetX = (page - 4) * More5LineWidth; 247 | } 248 | } 249 | } 250 | else { 251 | if (page == 1) { 252 | topTabOffsetX = 0 * More5LineWidth; 253 | }else { 254 | topTabOffsetX = page * More5LineWidth; 255 | } 256 | } 257 | [self.ninaBaseView.topTab setContentOffset:CGPointMake(topTabOffsetX, 0) animated:YES]; 258 | } 259 | if (!_loadWholePages) { 260 | for (NSInteger i = 0; i < titlesArray.count; i++) { 261 | if (page == i && i <= classArray.count - 1) { 262 | if ([classArray[i] isKindOfClass:[NSString class]]) { 263 | NSString *className = classArray[i]; 264 | Class class = NSClassFromString(className); 265 | if ([class isSubclassOfClass:[UIViewController class]] && viewAlloc[i] == NO) { 266 | UIViewController *ctrl = nil; 267 | ctrl = class.new; 268 | [self createOtherViewControllers:ctrl WithControllerTag:i]; 269 | }else if ([class isSubclassOfClass:[UIView class]]) { 270 | UIView *singleView =class.new; 271 | singleView.frame = CGRectMake(FUll_VIEW_WIDTH * i, 0, FUll_VIEW_WIDTH, self.frame.size.height - _topTabHeight); 272 | [self.ninaBaseView.scrollView addSubview:singleView]; 273 | }else if (!class) { 274 | NSLog(@"Your Vc%li is not found in this project!",(long)i + 1); 275 | } 276 | }else { 277 | if ([classArray[i] isKindOfClass:[UIViewController class]]) { 278 | UIViewController *ctrl = classArray[i]; 279 | if (ctrl && viewAlloc[i] == NO) { 280 | [self createOtherViewControllers:ctrl WithControllerTag:i]; 281 | }else if (!ctrl) { 282 | NSLog(@"Your Vc%li is not found in this project!",(long)i + 1); 283 | } 284 | }else if ([classArray[i] isKindOfClass:[UIView class]]) { 285 | UIView *singleView = classArray[i]; 286 | singleView.frame = CGRectMake(FUll_VIEW_WIDTH * i, 0, FUll_VIEW_WIDTH, self.frame.size.height - _topTabHeight); 287 | [self.ninaBaseView.scrollView addSubview:singleView]; 288 | } 289 | } 290 | }else if (page == i && i > classArray.count - 1) { 291 | NSLog(@"You are not set title%li 's controller.",(long)i + 1); 292 | }else { 293 | /**< The number of controllers max is 5. **/ 294 | if ([self.delegate respondsToSelector:@selector(deallocVCsIfUnnecessary)] && !_loadWholePages && _ninaDefaultPage == 0) { 295 | if (vcsArray.count > 5 && [self.delegate deallocVCsIfUnnecessary] == YES) { 296 | UIViewController *deallocVC = [vcsArray firstObject]; 297 | NSInteger deallocTag = [[vcsTagArray firstObject] integerValue]; 298 | if (![self.limitControllerCache objectForKey:@(deallocTag)]) { 299 | [self.limitControllerCache setObject:deallocVC forKey:@(deallocTag)]; 300 | }; 301 | [deallocVC.view removeFromSuperview]; 302 | deallocVC.view = nil; 303 | [deallocVC removeFromParentViewController]; 304 | deallocVC = nil; 305 | [vcsArray removeObjectAtIndex:0]; 306 | viewAlloc[deallocTag] = NO; 307 | [vcsTagArray removeObjectAtIndex:0]; 308 | } 309 | } 310 | } 311 | } 312 | } 313 | } 314 | } 315 | 316 | #pragma mark - Dealloc 317 | - (void)dealloc { 318 | [self.ninaBaseView removeObserver:self forKeyPath:kObserverPage context:nil]; 319 | } 320 | 321 | #pragma mark - NSCacheDelegate 322 | /**< NSCache delegate method,print current dealloc object. **/ 323 | - (void)cache:(NSCache *)cache willEvictObject:(id)obj { 324 | if (isDebugging) { 325 | NSLog(@"Dealloc -------> %@", obj); 326 | } 327 | } 328 | 329 | #pragma mark - Private Method 330 | /** 331 | * Create first controller or views. 332 | * 333 | * @param ctrl first controller. 334 | */ 335 | - (void)createFirstViewController:(UIViewController *)ctrl { 336 | firstVC = ctrl; 337 | self.lastObject = self.currentObject; 338 | self.currentObject = ctrl; 339 | ctrl.view.frame = CGRectMake(FUll_VIEW_WIDTH * _ninaDefaultPage, 0, FUll_VIEW_WIDTH, self.frame.size.height - _topTabHeight); 340 | [self.ninaBaseView.scrollView addSubview:ctrl.view]; 341 | /**< Add new test cache **/ 342 | if (![self.limitControllerCache objectForKey:@(0)]) { 343 | [self.limitControllerCache setObject:ctrl forKey:@(0)]; 344 | }; 345 | viewAlloc[_ninaDefaultPage] = YES; 346 | [vcsArray addObject:ctrl]; 347 | NSString *transString = [NSString stringWithFormat:@"%li",(long)_ninaDefaultPage]; 348 | [vcsTagArray addObject:transString]; 349 | if (isDebugging) { 350 | NSLog(@"Controller or view %@",transString); 351 | NSLog(@"Use new created controller or view %@",transString); 352 | } 353 | self.pageIndex = _ninaDefaultPage; 354 | } 355 | 356 | /** 357 | * Create other controllers or views. 358 | * 359 | * @param ctrl controllers. 360 | * @param i controller's tag. 361 | */ 362 | - (void)createOtherViewControllers:(UIViewController *)ctrl WithControllerTag:(NSInteger)i { 363 | [self.viewController addChildViewController:ctrl]; 364 | self.lastObject = self.currentObject; 365 | self.currentObject = ctrl; 366 | [vcsArray addObject:ctrl]; 367 | NSString *tagStr = @(i).stringValue; 368 | [vcsTagArray addObject:tagStr]; 369 | if (isDebugging) { 370 | NSLog(@"Use new created controller or view%li",(long)i + 1); 371 | } 372 | /**< The number of controllers max is 5. **/ 373 | if ([self.delegate respondsToSelector:@selector(deallocVCsIfUnnecessary)] && !_loadWholePages && _ninaDefaultPage == 0) { 374 | if (vcsArray.count > 5 && [self.delegate deallocVCsIfUnnecessary] == YES) { 375 | UIViewController *deallocVC = [vcsArray firstObject]; 376 | NSInteger deallocTag = [[vcsTagArray firstObject] integerValue]; 377 | if (![self.limitControllerCache objectForKey:@(deallocTag)]) { 378 | [self.limitControllerCache setObject:deallocVC forKey:@(deallocTag)]; 379 | }; 380 | [deallocVC.view removeFromSuperview]; 381 | deallocVC.view = nil; 382 | [deallocVC removeFromParentViewController]; 383 | deallocVC = nil; 384 | [vcsArray removeObjectAtIndex:0]; 385 | viewAlloc[deallocTag] = NO; 386 | if (isDebugging) { 387 | NSLog(@"Controller or view %li is dealloced",(long)deallocTag + 1); 388 | } 389 | [vcsTagArray removeObjectAtIndex:0]; 390 | } 391 | } 392 | ctrl.view.frame = CGRectMake(FUll_VIEW_WIDTH * i, 0, FUll_VIEW_WIDTH, self.frame.size.height - _topTabHeight); 393 | [self.ninaBaseView.scrollView addSubview:ctrl.view]; 394 | viewAlloc[i] = YES; 395 | } 396 | 397 | /** 398 | * Load whole page or not. 399 | * 400 | * @param ninaTag Viewcontroller or view tag. 401 | * @param mode Load whole page mode. 402 | */ 403 | - (void)loadWholeOrNotWithTag:(NSInteger)ninaTag WithMode:(NSInteger)mode { 404 | if ([classArray[ninaTag] isKindOfClass:[NSString class]]) { 405 | NSString *className = classArray[ninaTag]; 406 | Class class = NSClassFromString(className); 407 | if ([class isSubclassOfClass:[UIViewController class]]) { 408 | UIViewController *ctrl = class.new; 409 | if (mode == 0) { 410 | [self createFirstViewController:ctrl]; 411 | }else { 412 | [self createOtherViewControllers:ctrl WithControllerTag:ninaTag]; 413 | } 414 | }else if ([class isSubclassOfClass:[UIView class]]) { 415 | UIView *singleView =class.new; 416 | singleView.frame = CGRectMake(FUll_VIEW_WIDTH * ninaTag, 0, FUll_VIEW_WIDTH, self.frame.size.height - _topTabHeight); 417 | [self.ninaBaseView.scrollView addSubview:singleView]; 418 | } 419 | }else { 420 | if ([classArray[ninaTag] isKindOfClass:[UIViewController class]]) { 421 | UIViewController *ctrl = classArray[ninaTag]; 422 | if (mode == 0) { 423 | [self createFirstViewController:ctrl]; 424 | }else { 425 | [self createOtherViewControllers:ctrl WithControllerTag:ninaTag]; 426 | } 427 | }else if ([classArray[ninaTag] isKindOfClass:[UIView class]]) { 428 | UIView *singleView = classArray[ninaTag]; 429 | singleView.frame = CGRectMake(FUll_VIEW_WIDTH * ninaTag, 0, FUll_VIEW_WIDTH, self.frame.size.height - _topTabHeight); 430 | [self.ninaBaseView.scrollView addSubview:singleView]; 431 | } 432 | } 433 | } 434 | 435 | - (void)currentPageAndObject { 436 | if ([self.delegate respondsToSelector:@selector(ninaCurrentPageIndex:currentObject:lastObject:)]) { 437 | [self.delegate ninaCurrentPageIndex:self.pageIndex currentObject:self.currentObject lastObject:self.lastObject]; 438 | } 439 | } 440 | 441 | @end 442 | -------------------------------------------------------------------------------- /NinaPagerView/UIParameter.h: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 RamWire ( https://github.com/RamWire ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #ifndef UIParameter_h 24 | #define UIParameter_h 25 | 26 | //是否需要打印调试(Print log or not) 27 | #define isDebugging NO 28 | //十六进制颜色值(hex ColorRGB) 29 | #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] 30 | //全屏宽和高大小(Full screen width and height) 31 | #define FUll_VIEW_WIDTH ([[UIScreen mainScreen] bounds].size.width) 32 | #define FUll_VIEW_HEIGHT ([[UIScreen mainScreen] bounds].size.height) 33 | #define FUll_CONTENT_HEIGHT FUll_VIEW_HEIGHT - NavigationBarHeight 34 | #define TabbarHeight 49 35 | #define NavigationBarHeight 64 36 | #define PageBtn 40 37 | #define More5LineWidth FUll_VIEW_WIDTH / 5.0 //超过5个标题的宽度(Width of more than five titles) 38 | 39 | #endif /* UIParameter_h */ 40 | 41 | 42 | -------------------------------------------------------------------------------- /NinaPagerView/UIView+ViewController.h: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 RamWire ( https://github.com/RamWire ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import 24 | 25 | @interface UIView (VIewController) 26 | 27 | - (UIViewController *)viewController; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /NinaPagerView/UIView+ViewController.m: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2015-2016 RamWire ( https://github.com/RamWire ) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #import "UIView+ViewController.h" 24 | 25 | @implementation UIView (ViewController) 26 | 27 | - (UIViewController *)viewController { 28 | UIResponder *next = self.nextResponder; 29 | do { 30 | if ([next isKindOfClass:[UIViewController class]]) { 31 | return (UIViewController *)next; 32 | } 33 | next = next.nextResponder; 34 | }while (next != nil); 35 | return nil; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /NinaPagerViewCarthage/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /NinaPagerViewCarthage/NinaPagerViewCarthage.h: -------------------------------------------------------------------------------- 1 | // 2 | // NinaPagerViewCarthage.h 3 | // NinaPagerViewCarthage 4 | // 5 | // Created by RamWire on 16/4/14. 6 | // Copyright © 2016年 RamWire. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "NinaPagerView.h" 11 | #import "UIParameter.h" 12 | #import "NinaBaseView.h" 13 | #import "UIView+ViewController.h" 14 | 15 | //! Project version number for NinaPagerViewCarthage. 16 | FOUNDATION_EXPORT double NinaPagerViewCarthageVersionNumber; 17 | 18 | //! Project version string for NinaPagerViewCarthage. 19 | FOUNDATION_EXPORT const unsigned char NinaPagerViewCarthageVersionString[]; 20 | 21 | // In this header, you should import all the public headers of your framework using statements like #import 22 | 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/Slice1.png) 2 | [![Language](https://img.shields.io/badge/Language-%20Objective--C%20-orange.svg)](https://img.shields.io/badge/Language-%20Objective--C%20-orange.svg) 3 | [![Build Status](https://travis-ci.org/RamWire/NinaPagerView.svg?branch=master)](https://travis-ci.org/RamWire/NinaPagerView) 4 | [![Pod Version](http://img.shields.io/cocoapods/v/NinaPagerView.svg?style=flat)](http://cocoadocs.org/docsets/NinaPagerView/) 5 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 6 | [![Pod Platform](http://img.shields.io/cocoapods/p/NinaPagerView.svg?style=flat)](http://cocoadocs.org/docsets/NinaPagerView/) 7 | [![Support](https://img.shields.io/badge/support-iOS%206%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/)  8 | [![Pod License](http://img.shields.io/cocoapods/l/NinaPagerView.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html)
9 | 🇨🇳[中文文档说明](https://github.com/RamWire/NinaPagerView/blob/master/README_CN.md) 10 | * NinaPagerView is a segment easy to page your controllers and views.
11 | 12 | ## Features 13 | - [x] Low coupling,just create your own viewcontrollers or views,that's it! 14 | - [x] Load your viewcontrollers or views.Not load at the same time. 15 | - [x] Just one line codes to finish the mission. 16 | - [x] Edit everything in TopTab as you wish,you can custom your own views here. 17 | - [x] Not only fits UIViewController,but also fits UIView. 18 | - [x] Select NinaPagerStyle as you wish. 19 | - [x] Easily reload titles and objects(views,controllers and xibs). 20 | 21 | ## Preview 22 | 23 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/NinaPagerViewGif1.gif) 24 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/NinaPagerViewGif2.gif) 25 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/NinaPagerViewGif3.gif) 26 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/NinaPagerViewGif4.gif) 27 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/NinaPagerViewGif5.gif) 28 | 29 | ## Installation 30 | 31 | Drop in the Classes folder to your Xcode project. 32 | You can also use cocoapods or Carthage. 33 | 34 | #### Using [CocoaPods](http://cocoapods.org/) 35 | 36 | Add `pod 'NinaPagerView'` to your `Podfile` and run `pod install`. 37 | 38 | ``` 39 | pod 'NinaPagerView' 40 | ``` 41 | 42 | #### Using [Carthage](https://github.com/Carthage/Carthage) 43 | Add the following line to your Cartfile: 44 | ``` 45 | github "RamWire/NinaPagerView" 46 | ``` 47 | 48 | ## Usage 49 | You need add '**NinaPagerView.h**'(**CocoaPods**) or <**NinaPagerViewCarthage/NinaPagerViewCarthage.h**>(**Carthage**) to your project.Then load the codes: 50 | ```objc 51 | NinaPagerView *ninaPagerView = [[NinaPagerView alloc] initWithFrame:pagerRect WithTitles:titleArray WithObjects:objects]; 52 | [self.view addSubview:ninaPagerView]; 53 | ``` 54 | That's all! 55 | 56 | ### Other Settings and Tips 57 | * Numerous **properties** in NinaPagerView you can set as you wish. 58 | * NinaPagerView now supports **custom topTab menus**.Creating your own views into NinaPagerView!(read the Example notes if you wanna to know more) 59 | * You can set two necessary Array by following codes(please read the Example notes if you wanna to know more). 60 | ```objc 61 | NSArray *titles = @[ 62 | @"Dalian", 63 | @"Tokyo", 64 | @"New York", 65 | @"Los Angeles", 66 | @"Kyoto", 67 | @"Osaka", 68 | @"Auckland", 69 | @"Miami", 70 | @"Houston" 71 | ]; 72 | NSArray *objects = @[ 73 | @"FirstView", 74 | @"SecondView", 75 | @"ThirdView", 76 | @"ForthView", 77 | @"FifthView", 78 | @"SixthView", 79 | @"SeventhView", 80 | @"EighthView", 81 | @"NinthView", 82 | ]; 83 | ``` 84 | * If your controller doesn't have navigationBar or you hide the navigationBar,you need set **nina_navigationBarHidden** to YES. 85 | ```objc 86 | ninaPagerView.nina_navigationBarHidden = YES; 87 | ``` 88 | * Superior limit of creating controllers or views is **10**,if wanna more,please modify **MaxNums** in NinaPagerView. 89 | * If you need push to the controller which contains NinaPagerView,please make sure your **navigationBar's translucent** is **NO**.You can set like this: 90 | ```objc 91 | self.navigationController.navigationBar.translucent = NO; 92 | ``` 93 | * If you use controllers way, please make sure add subview in viewWillLayoutSubviews method, it's not work in viewDidLoad method, you can find more in demo. 94 | 95 | ### NinaPagerViewDelegate 96 | #### Memory Management 97 | * If you care the vcs causes huge memory,please try NinaPagerViewDelegate delegate,default is load recent 5 vcs,others will dealloc.If you scroll to the dealloc page, it will load again.If you don't use the delegate,default is NO. 98 | ```objc 99 | - (BOOL)deallocVCsIfUnnecessary { 100 | return YES; 101 | } 102 | ``` 103 | #### Current Page 104 | * Get current page and objects by the delegate method, you can code here when you need it. 105 | ```objc 106 | - (void)ninaCurrentPageIndex:(NSInteger)currentPage currentObject:(id)currentObject lastObject:(id)lastObject { 107 | NSLog(@"Current page is %li",currentPage); 108 | } 109 | ``` 110 | ## Licence 111 | 112 | This project uses MIT License. 113 | -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/Slice1.png) 2 | [![Language](https://img.shields.io/badge/Language-%20Objective--C%20-orange.svg)](https://img.shields.io/badge/Language-%20Objective--C%20-orange.svg) 3 | [![Build Status](https://travis-ci.org/RamWire/NinaPagerView.svg?branch=master)](https://travis-ci.org/RamWire/NinaPagerView) 4 | [![Pod Version](http://img.shields.io/cocoapods/v/NinaPagerView.svg?style=flat)](http://cocoadocs.org/docsets/NinaPagerView/) 5 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 6 | [![Pod Platform](http://img.shields.io/cocoapods/p/NinaPagerView.svg?style=flat)](http://cocoadocs.org/docsets/NinaPagerView/) 7 | [![Support](https://img.shields.io/badge/support-iOS%206%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/)  8 | [![Pod License](http://img.shields.io/cocoapods/l/NinaPagerView.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html) 9 | 10 | * 一行代码搞定顶部菜单栏。类似网易新闻、今日头条、虎扑看球等app做的一个顶部菜单栏,每栏中有独立的控制器,可自己定制。 11 | 12 | ## 特点 13 | - [x] 低耦合,您只需创建视图或控制器即可。 14 | - [x] 可分步加载您所添加的视图,实现类似网易新闻,虎扑看球的效果。 15 | - [x] 只需一行代码创建即可实现所有功能。 16 | - [x] 菜单栏可随需求自己定制,不仅仅局限于标题样式。 17 | - [x] 支持storyboard。 18 | - [x] 可根据您的需求对上方的滑块进行选择,无论是背景颜色还是文字颜色。 19 | - [x] 像今日头条、网易新闻一样进行标题和内容的动态添加和删除。 20 | 21 | ## 预览 22 | 23 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/NinaPagerViewGif1.gif) 24 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/NinaPagerViewGif2.gif) 25 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/NinaPagerViewGif3.gif) 26 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/NinaPagerViewGif4.gif) 27 | ![image](https://github.com/RamWire/NinaPagerView/blob/master/Example/Gifs/NinaPagerViewGif5.gif) 28 | 29 | ## 安装 30 | 31 | 将NinaPagerView文件夹拖入Xcode工程中 32 | 您也可以使用Cocoapods或者Carthage集成到您的工程中 33 | 34 | #### 使用 [CocoaPods](http://cocoapods.org/) 35 | 36 | 在您的podfile中加入`pod 'NinaPagerView'` 然后运行`pod install`。 37 | 38 | ``` 39 | pod 'NinaPagerView' 40 | ``` 41 | 42 | #### 使用 [Carthage](https://github.com/Carthage/Carthage) 43 | 在Cartfile中加入下方代码: 44 | ``` 45 | github "RamWire/NinaPagerView" 46 | ``` 47 | 48 | ## 使用 49 | 您需要将'**NinaPagerView.h**'(**CocoaPods**) or <**NinaPagerViewCarthage/NinaPagerViewCarthage.h**>(**Carthage**) 加入到您的工程中,然后执行下列代码: 50 | ```objc 51 | NinaPagerView *ninaPagerView = [[NinaPagerView alloc] initWithFrame:pagerRect WithTitles:titleArray WithObjects:objects]; 52 | [self.view addSubview:ninaPagerView]; 53 | ``` 54 | 即可完成~ 55 | 56 | ### 其他设置和补充 57 | * 庞大的**自定义属性**您可以在NinaPagerView中设置。 58 | * NinaPagerView支持**顶部菜单栏自定义配置**,创建自己想要的样式,加入到NinaPagerView中吧(具体说明配置请看Example中的注释)。 59 | * 在配置**NinaPagerView**所需的两个数组时,您可以参照下方的代码进行配置(具体说明请看Example中的注释)。 60 | ```objc 61 | NSArray *titles = @[ 62 | @"大连市", 63 | @"甘井子", 64 | @"星海广场", 65 | @"西岗", 66 | @"马栏子", 67 | @"革镇堡", 68 | @"中山", 69 | @"人民广场", 70 | @"中山广场" 71 | ]; 72 | NSArray *objects = @[ 73 | @"FirstView", 74 | @"SecondView", 75 | @"ThirdView", 76 | @"ForthView", 77 | @"FifthView", 78 | @"SixthView", 79 | @"SeventhView", 80 | @"EighthView", 81 | @"NinthView", 82 | ]; 83 | ``` 84 | * 如果您将导航栏隐藏或者没有导航栏,您需要设置**nina_navigationBarHidden**为YES。
85 | ```objc 86 | ninaPagerView.nina_navigationBarHidden = YES; 87 | ``` 88 | * 您可以自定义设置的控制器或视图最多为**10**,如果您想创建更多,可以对NinaPagerView中的**MaxNums**进行设置。 89 | * 如果您需要push到包含NinaPagerView的控制器,请确保**前一级**控制器导航栏的**translucent**为**NO**,如果没有,您可以按照如下代码进行设置: 90 | ```objc 91 | self.navigationController.navigationBar.translucent = NO; 92 | ``` 93 | * 如果使用的是控制器数组,并且控制器里需要添加视图,建议您在viewWillLayoutSubviews中进行addSubview操作,在viewDidLoad方法里并不奏效,具体请看demo中的代码。 94 | 95 | ### NinaPagerViewDelegate 96 | #### 关于内存管理 97 | * 如果您觉得创建的控制器过多(>5)占用内存过大,请使用NinaPagerViewDelegate。默认只保留5个最近滑到的控制器,剩下的控制器将被释放,直到您再滑到相应位置才会被重新加载,如果不执行此代理,则默认为不释放。
98 | ```objc 99 | - (BOOL)deallocVCsIfUnnecessary { 100 | return YES; 101 | } 102 | ``` 103 | #### 关于获取到当前显示的界面 104 | * 由于子控制器的限制,您无法捕捉到对应的控制器的ViewWillAppear等生命周期里关于appear的方法,为了达到相同的功能,您可以通过此代理方法来获取到当前页码、当前对象及上一个对象进而对相关的控制器进行操作。 105 | ```objc 106 | - (void)ninaCurrentPageIndex:(NSInteger)currentPage currentObject:(id)currentObject lastObject:(id)lastObject { 107 | NSLog(@"Current page is %li",currentPage); 108 | } 109 | ``` 110 | ## Licence 111 | 112 | This project uses MIT License. 113 | --------------------------------------------------------------------------------