- NinaPagerView is a segment easy to page your controllers and views.
Features
- Low coupling,just create your own viewcontrollers or views,that's it!
- Load your viewcontrollers or views.Not load at the same time.
- Just one line codes to finish the mission.
- Edit everything in TopTab as you wish,you can custom your own views here.
- Not only fits UIViewController,but also fits UIView.
- Select NinaPagerStyle as you wish.
- Easily reload titles and objects(views,controllers and xibs).
Preview
Installation
Drop in the Classes folder to your Xcode project.
You can also use cocoapods or Carthage.
CocoaPods
UsingAdd pod 'NinaPagerView'
to your Podfile
and run pod install
.
pod 'NinaPagerView'
Carthage
UsingAdd the following line to your Cartfile:
github "RamWire/NinaPagerView"
Usage
You need add 'NinaPagerView.h'(CocoaPods) or <NinaPagerViewCarthage/NinaPagerViewCarthage.h>(Carthage) to your project.Then load the codes:
NinaPagerView *ninaPagerView = [[NinaPagerView alloc] initWithFrame:pagerRect WithTitles:titleArray WithObjects:objects];
[self.view addSubview:ninaPagerView];
That's all!
Other Settings and Tips
- Numerous properties in NinaPagerView you can set as you wish.
- NinaPagerView now supports custom topTab menus.Creating your own views into NinaPagerView!(read the Example notes if you wanna to know more)
- You can set two necessary Array by following codes(please read the Example notes if you wanna to know more).
NSArray *titles = @[
@"Dalian",
@"Tokyo",
@"New York",
@"Los Angeles",
@"Kyoto",
@"Osaka",
@"Auckland",
@"Miami",
@"Houston"
];
NSArray *objects = @[
@"FirstView",
@"SecondView",
@"ThirdView",
@"ForthView",
@"FifthView",
@"SixthView",
@"SeventhView",
@"EighthView",
@"NinthView",
];
- If your controller doesn't have navigationBar or you hide the navigationBar,you need set nina_navigationBarHidden to YES.
ninaPagerView.nina_navigationBarHidden = YES;
- Superior limit of creating controllers or views is 10,if wanna more,please modify MaxNums in NinaPagerView.
- If you need push to the controller which contains NinaPagerView,please make sure your navigationBar's translucent is NO.You can set like this:
self.navigationController.navigationBar.translucent = NO;
- 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.
NinaPagerViewDelegate
Memory Management
- 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.
- (BOOL)deallocVCsIfUnnecessary {
return YES;
}
Current Page
- Get current page and objects by the delegate method, you can code here when you need it.
- (void)ninaCurrentPageIndex:(NSInteger)currentPage currentObject:(id)currentObject lastObject:(id)lastObject {
NSLog(@"Current page is %li",currentPage);
}
Licence
This project uses MIT License.