DKTabPageViewController is an UIViewController subclass that support for multiple tab and gestures.
Add #import "DKTabPageViewController.h"
to the top of classes that will use it.
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];
[self addChildViewController:tabPageViewController];
[self.view addSubview:tabPageViewController.view];
@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);
/**
* 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;
This code is distributed under the terms and conditions of the MIT license.