TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
RoleTabBarController provide Implementing UITabBarController pattern.
<UITableViewDataSource>
patterns.RoleTabBarController
is not special, but it's just another pattern.
pod 'RoleTabBarController'
See Example/
or
pod try RoleTabBarController
You should implement <RoleTabBarDataSource>
protocol on subclass of RoleTabBarController
@protocol RoleTabBarDataSource <NSObject>
/**
* Life Cycle
*
* numberOfRoleTabBarController
* -> ViewController - viewControllerAtIndex
* -> TabBarItem - tabBarItemObjectAtIndex
* -> TabBarItem - willShowTabBar
*/
- (NSUInteger)numberOfRoleTabBarController:(RoleTabBarController *) tabBarController;
- (UIViewController *)roleTabBarController:(RoleTabBarController *) tabBarController viewControllerAtIndex:(NSUInteger) index;
- (RoleTabBarItemObject *)roleTabBarController:(RoleTabBarController *) tabBarController tabBarItemObjectAtIndex:(NSUInteger) index;
@optional
- (void)roleTabBarController:(RoleTabBarController *) tabBarController willShowTabBar:(UITabBarItem *) tabBarItem atIndex:(NSUInteger) index;
@end
RoleTabBarController
and adopt <RoleTabBarDataSource>
protocol on the subclass(AppTabBarController) <RoleTabBarDataSource>
protocol@interface AppTabBarController : RoleTabBarController <RoleTabBarDataSource>
@end
@interface AppTabBarController ()
@property(nonatomic, strong) AppTabBarControllerModel *model;
@end
@implementation AppTabBarController
- (AppTabBarControllerModel *)model {
if (_model == nil) {
_model = [[AppTabBarControllerModel alloc] init];
}
return _model;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.dataSource = self;
[self reloadData];
}
#pragma mark - RoleTabBarController
- (NSUInteger)numberOfRoleTabBarController:(RoleTabBarController *) tabBarController {
return 4;
}
- (UIViewController *)roleTabBarController:(RoleTabBarController *) tabBarController viewControllerAtIndex:(NSUInteger) index {
return [self.model viewControllerAtType:(AppTabBarControllerType)index];
}
- (RoleTabBarItemObject *)roleTabBarController:(RoleTabBarController *) tabBarController tabBarItemObjectAtIndex:(NSUInteger) index {
return [self.model tabBarItemObjectAtIndex:index];
}
@end
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
MIT