Giter VIP home page Giter VIP logo

guitabpagerviewcontroller's Introduction

GUITabPagerViewController

CocoaPods CocoaPods CocoaPods CocoaPods CocoaPods

Animated gif

Installation

CocoaPods (recommended)
Add the following line to your Podfile:
pod 'GUITabPagerViewController', '~> 0.1.0'
And then add #import <GUITabPagerViewController.h> to your view controller.

Manual
Copy the folders Classes to your project, then add #import "GUITabPagerViewController.h" to your view controller.

Usage

To use it, you should create a view controller that extends GUITabPagerViewController. Write your viewDidLoad as follows:

- (void)viewDidLoad {
  [super viewDidLoad];
  [self setDataSource:self];
}

- (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:animated];
  [self reloadData]; }

Then, implement the GUITabPagerDataSource to populate the view. The data source has a couple of required methods, and a few more optional.

Data Source

The data source methods will allow you to provide content to your tab pager view controller.

Required Methods

- (NSInteger)numberOfViewControllers;
- (UIViewController *)viewControllerForIndex:(NSInteger)index;

Optional Methods

Note that despite being optional, the tab setup will require you to return either a UIView or an NSString to work.

- (UIView *)viewForTabAtIndex:(NSInteger)index;
- (NSString *)titleForTabAtIndex:(NSInteger)index;
- (CGFloat)tabHeight;  // Default value: 44.0f
- (UIColor *)tabColor; // Default value: [UIColor orangeColor]
- (UIColor *)tabBackgroundColor; // Default: [UIColor colorWithWhite:0.95f alpha:1.0f];
- (UIFont *)titleFont; // Default: [UIFont fontWithName:@"HelveticaNeue-Thin" size:20.0f];
- (UIColor *)titleColor; // Default: [UIColor blackColor];

Delegate

The delegate methods report events that happened in the tab pager view controller.

Optional Methods

- (void)tabPager:(GUITabPagerViewController *)tabPager willTransitionToTabAtIndex:(NSInteger)index;
- (void)tabPager:(GUITabPagerViewController *)tabPager didTransitionToTabAtIndex:(NSInteger)index;

Public Methods

There are two public methods:

- (void)reloadData;
- (NSInteger)selectedIndex;

reloadData will refresh the content of the tab pager view controller. Make sure to provide the data source before reloading the content.

selectedIndex will return the index of the current selected tab.

guitabpagerviewcontroller's People

Contributors

guilhermearaujo avatar fabio-nogueira-almeida avatar hcbarry avatar evfemist avatar

Watchers

钱塘江木鱼 avatar James Cloos 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.