Latest 1.0.3
Homepage https://github.com/FuJunZhi/FUTabBarController
License MIT
Platforms ios 7.0, requires ARC
Authors

*Custom FUTabBarController
包括功能:选中按钮动画(缩放/旋转)、选中字体可以改变大小颜色、所有按钮都可以凸起、自定义push/模态跳转、角标的自定义

CocoaPods

  1. Add pod 'FUTabBarController', '~> 1.0.3' to your Podfile.

  2. Run pod install or pod update.

  3. 创建UITabBarController自定义类 继承FUTabBarController
  4. 具体实现可以看demoHome->MainTabBarController.m

带动画的效果图

FUTabBarController
FUTabBarController

有标题 + 凸出

FUTabBarController

无标题 + 凸出

FUTabBarController

有标题 + 不凸出

FUTabBarController

无标题 + 不凸出

FUTabBarController

父类中提供的方法

/**
* TabBarSelectAnimationDefault = 0, //无动画
* TabBarSelectAnimationScale,       //缩放动画
* TabBarSelectAnimationRotate       //旋转动画 
*/
@property (nonatomic, assign) TabBarSelectAnimation selectAnimation;

/**
*  初始化一个子控制器
*
*  @param childVc               需要初始化的子控制器
*  @param navigationController  导航控制器
*  @param title                 标题
*  @param imageName             图标
*  @param selectedImageName     选中的图标
*  @param offset                是否凸出(YES:按钮向上凸出)
*/
- (UIViewController *)setupChildViewController:(UIViewController *)childVc navigationController:(Class)navigationController title:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName offset:(BOOL)offset;

//添加中心按钮:模态...(子类调用)
- (void)addCenterItemWithIcon:(NSString *)iconName selectedIcon:(NSString *)selectedIconName title:(NSString *)title offset:(BOOL)offset clickBlock:(ClickBlock)block;
@end

子类中给viewControllers赋值就可以了

- (void) setUpChildControllers
{
//动态
UIStoryboard *trendsStB = [UIStoryboard storyboardWithName:@"TrendsViewController" bundle:nil];
TrendsViewController *trendsVC = [trendsStB instantiateViewControllerWithIdentifier:@"TrendsViewController"];
UIViewController *trendsNVC = [self setupChildViewController:trendsVC navigationController:[MainNavController class] title:@"动态" imageName:@"trends_nomal.png" selectedImageName:@"trends_select.png" offset:NO];

//名片
UIStoryboard *callingCardStB = [UIStoryboard storyboardWithName:@"CallingCardViewController" bundle:nil];
CallingCardViewController *callingCardVC = [callingCardStB instantiateViewControllerWithIdentifier:@"CallingCardViewController"];
UIViewController *callingCardNVC = [self setupChildViewController:callingCardVC navigationController:[MainNavController class] title:@"名片" imageName:@"callingCard_nomal.png" selectedImageName:@"callingCard_select.png" offset:NO];

//宝信
UIStoryboard *baoXinStB = [UIStoryboard storyboardWithName:@"BaoXunViewController" bundle:nil];
BaoXunViewController *baoXinVC = [baoXinStB instantiateViewControllerWithIdentifier:@"BaoXunViewController"];
UIViewController *baoXinNVC = [self setupChildViewController:baoXinVC navigationController:[MainNavController class] title:@"宝信" imageName:@"baoxin_nomal.png" selectedImageName:@"baoxin_select.png" offset:NO];

//我的
UIStoryboard *mineStB = [UIStoryboard storyboardWithName:@"MineViewController" bundle:nil];
MineViewController *mineVC = [mineStB instantiateViewControllerWithIdentifier:@"MineViewController"];
UIViewController *mineNVC = [self setupChildViewController:mineVC navigationController:[MainNavController class] title:@"我的" imageName:@"mine_nomal.png" selectedImageName:@"mine_select.png" offset:NO];

self.viewControllers = @[trendsNVC, callingCardNVC, baoXinNVC, mineNVC];

//添加中心按钮(只适用于中心按钮模态弹出)
//offset:是否凸出
__weak typeof(self) weakSelf = self;
[self addCenterItemWithIcon:@"search_nomal" selectedIcon:@"search_nomal" title:@"搜索" offset:YES clickBlock:^{
UIStoryboard *board = [UIStoryboard storyboardWithName:@"SearchViewController" bundle:nil];
SearchViewController *searchVC= [board instantiateViewControllerWithIdentifier:@"SearchViewController"];
UIViewController *searchNVC = [weakSelf setupChildViewController:searchVC navigationController:[MainNavController class] title:@"我的" imageName:@"" selectedImageName:@"" offset:NO];

[weakSelf presentViewController:searchNVC animated:YES completion:nil];
}];

}

@end

Latest podspec

{
    "name": "FUTabBarController",
    "version": "1.0.3",
    "summary": "custom FUTabBar",
    "homepage": "https://github.com/FuJunZhi/FUTabBarController",
    "license": "MIT",
    "authors": {
        "fujunzhi": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/FuJunZhi/FUTabBarController.git",
        "tag": "1.0.3"
    },
    "source_files": "FUTabBarController/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This