Git Product home page Git Product logo

ninapagerview's Introduction

image Language Build Status Pod Version Carthage compatible Pod Platform Support  Pod License
🇨🇳中文文档说明

  • 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

image image image image image

Installation

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"

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;

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);
}

Change Log

v1.6.2

Updated codes for iOS 11,and other improvements.

v1.6.0

Add ninaChosenPage and reload data function.

v1.5.3

Add topTabScrollHidden function.

v1.5.1

Add custom topTab menus function,custom your own topTab!

v1.4.8

Add nina_scrollEnabled and nina_autoBottomLineEnable functions to NinaPagerView,meanwhile try to fix KVO crash in some conditions.

v1.4.6

Fix a bug may cause NinaPagerView in wrong location.

v1.4.5

Fix scrollsToTop conflict issue.

v1.4.3

Add properties for setting colors,now you just set frame,titleArray and vcsArray in init method.

v1.4.2

Add properties for setting topTab's height and title font,what's more,able to set toptab whole underline hidden.

v1.4.1

Fix some bugs and now you need not set navigationBar.translucent to NO,NinaPagerView will do it.

v1.4.0

Change numerous macro definitions to NinaPagerView's properties.More flexible to use NinaPagerView in different situations.

v1.3.0

Add NinaDefaultPageIndex in UIParameter.h to select default page.

v1.2.0

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.

v1.1.2

Optimize two-line title and details in SlideBlock.

v1.1.1

NinaSlideBlock support two-line display in NinaPagerView.

v1.1.0

Support navigationBarHidden situation,now you can select navigationBar hidden or not.

v1.0.0

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.

v0.9.1

Add some parameters to toptab's bottomline or slider,now you can set their width and height to the project.

v0.8.1

Fix topTab vertical-scroll in some conditions.

v0.8.0

New selection of topTab style,now you can choose NinaPagerStyleBottomLine and NinaPagerStyleSlideBlock as gifs showed.

v0.7.0

If you think vcs is not comfortable for your project, you can use view arrays to built.Just put views into array~

v0.6.0

Support long-length title.

v0.5.2

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;

v0.5.0

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.

FeedBack

  • If you find bugs in this project or any suggestions,hope you can give me feedback by issues or Email me to [email protected].

Licence

This project uses MIT License.

ninapagerview's People

Contributors

ramwire avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.