Latest1.0.0
Homepagehttps://github.com/azu/RoleTabBarController
LicenseMIT
Platformsios 6.0, requires ARC
Authors

CI Status
Version
License
Platform

RoleTabBarController provide Implementing UITabBarController pattern.

  • Similar to <UITableViewDataSource> patterns.

RoleTabBarController is not special, but it’s just another pattern.

Installation

pod 'RoleTabBarController'

Example

See Example/ or

pod try RoleTabBarController

RoleTabBarDataSource

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

How to use

  1. You create Subclass of RoleTabBarController and adopt <RoleTabBarDataSource> protocol on the subclass(AppTabBarController)
  2. You should implement <RoleTabBarDataSource> protocol
  3. That’s all
@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

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

Latest podspec

{
    "name": "RoleTabBarController",
    "version": "1.0.0",
    "summary": "UITabBarController patterns library - similar to  patterns.",
    "homepage": "https://github.com/azu/RoleTabBarController",
    "license": "MIT",
    "authors": {
        "azu": "[email protected]"
    },
    "source": {
        "git": "https://github.com/azu/RoleTabBarController.git",
        "tag": "1.0.0"
    },
    "social_media_url": "https://twitter.com/azu_re",
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes"
}

Pin It on Pinterest

Share This