/DKTabPageViewController

DKTabPageViewController is an UIViewController subclass that supports multiple tab and gestures.

Primary LanguageObjective-CMIT LicenseMIT

DKTabPageViewController

GIF GIF GIF

Overview

DKTabPageViewController is an UIViewController subclass that support for multiple tab and gestures.

How To Get Started

Add #import "DKTabPageViewController.h" to the top of classes that will use it.

Initialize the DKTabPageViewController with an array of DKTabPageItem.

NSMutableArray *items = [NSMutableArray arrayWithCapacity:5];
for (int i = 0; i < 5; i++) {
    TableViewController *vc = [TableViewController new];
    
    DKTabPageItem *item = [DKTabPageViewControllerItem tabPageItemWithTitle:[NSString stringWithFormat:@"Tab %d" ,i]
                                                             viewController:vc];
    [items addObject:item];
}

DKTabPageViewController *tabPageViewController = [[DKTabPageViewController alloc] initWithItems:items];

Add the DKTabPageViewController's view as a subview

[self addChildViewController:tabPageViewController];
[self.view addSubview:tabPageViewController.view];

Flexible and easy to use interface

@property (nonatomic, assign) NSInteger selectedIndex;
@property (nonatomic, readonly) UIViewController *selectedViewController;

/**
 *  Whether show the Tab Bar. Defaults to YES.
 */
@property (nonatomic, assign) BOOL showTabPageBar;

/**
 *  Whether allow scroll gestures. Defaults to YES.
 */
@property (nonatomic, assign) BOOL gestureScrollEnabled;

/**
 *  The block to be executed on the page changed.
 */
@property (nonatomic, copy) void (^pageChangedBlock)(NSInteger selectedIndex);

Customizable Tab Bar

/**
 *  Height of the tab bar. Defautls to 40.
 */
@property (nonatomic, assign) CGFloat tabBarHeight UI_APPEARANCE_SELECTOR;

/**
 *  Font of the tab bar. Defautls to [UIFont systemFontOfSize:14].
 */
@property (nonatomic, strong) UIFont *titleFont UI_APPEARANCE_SELECTOR;

/**
 *  The selection indicator is draw on bottom of the tab bar.
 */
@property (nonatomic, strong) UIView *selectionIndicatorView;

@property(nonatomic, copy) UIColor *backgroundColor UI_APPEARANCE_SELECTOR;

License

This code is distributed under the terms and conditions of the MIT license.