🇨🇳中文文档说明
- NinaPagerView is a segment easy to page your controllers and views.
- 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).
Drop in the Classes folder to your Xcode project.
You can also use cocoapods or Carthage.
Using CocoaPods
Add pod 'NinaPagerView'
to your Podfile
and run pod install
.
pod 'NinaPagerView', '~> 1.6.2'
Using Carthage
Add the following line to your Cartfile:
github "RamWire/NinaPagerView"
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!
- 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 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;
}
- 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);
}
Updated codes for iOS 11,and other improvements.
Add ninaChosenPage and reload data function.
Add topTabScrollHidden function.
Add custom topTab menus function,custom your own topTab!
Add nina_scrollEnabled and nina_autoBottomLineEnable functions to NinaPagerView,meanwhile try to fix KVO crash in some conditions.
Fix a bug may cause NinaPagerView in wrong location.
Fix scrollsToTop conflict issue.
Add properties for setting colors,now you just set frame,titleArray and vcsArray in init method.
Add properties for setting topTab's height and title font,what's more,able to set toptab whole underline hidden.
Fix some bugs and now you need not set navigationBar.translucent to NO,NinaPagerView will do it.
Change numerous macro definitions to NinaPagerView's properties.More flexible to use NinaPagerView in different situations.
Add NinaDefaultPageIndex in UIParameter.h to select default page.
Add LoadWholePage in parameter.h that you can set YES to load all controllers or views at the same time.
New delegate method for NinaPagerView to get current page easily.
Optimize two-line title and details in SlideBlock.
NinaSlideBlock support two-line display in NinaPagerView.
Support navigationBarHidden situation,now you can select navigationBar hidden or not.
Improves some codes,meanwhile brings some changes for the framework,wish you like it:)
(1) Add a new NinaPagerStyle:NinaPagerStyleStateNormal,it's a style which not has bottomline or sliderblock.You can choose it if needed.
(2) Creating Arrays in Example is changed,more clearly!
(3) TopTab height fasten to 40,if you wanna to change it,please set it in UIParameter.h.
(4) In NinaPagerStyleSliderBlock,now you can set block's cornerRadius by setting in UIParameter.h.
Add some parameters to toptab's bottomline or slider,now you can set their width and height to the project.
Fix topTab vertical-scroll in some conditions.
New selection of topTab style,now you can choose NinaPagerStyleBottomLine and NinaPagerStyleSlideBlock as gifs showed.
If you think vcs is not comfortable for your project, you can use view arrays to built.Just put views into array~
Support long-length title.
You can set titleSize for title animation(compare to origin title),command range between 1 and 1.5.If don't set this,default scale is 1.15.
ninaPagerView.titleScale = 1.5;
If you wanna create VCs by IB or code by yourself, you can put VCs into array.You can create them like the Example codes.
- If you find bugs in this project or any suggestions,hope you can give me feedback by issues or Email me to zhaogengda@126.com.
This project uses MIT License.