RDVTabBarController--可自由定制的iOS底部导航控件的使用总结

  • RDVTabBarController:一个十分完善的tabBarController,可以自定义角标个数,爽的停不下来。

  • RDVTabBarController地址:RDVTabBarController

  • Demo地址:欢迎Star


    一、RDVTabBarController的功能性代码介绍:

    1.设置角标数

     [[self rdv_tabBarItem] setBadgeValue:@"3"];

    2.RDVTabBarControllerDelegate代码

    /**
     * Asks the delegate whether the specified view controller should be made active.
     */
    - (BOOL)tabBarController:(RDVTabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController;


    /**
     * Tells the delegate that the user selected an item in the tab bar.
     */
    - (void)tabBarController:(RDVTabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController;

    3.RDVTabBarController的底部tabbar字体与图片修改

     
    - (void)customizeTabBarForController{
    
        //tabbar 背景图片 tabbar_background
        UIImage *backgroundImage = [UIImage imageNamed:@"tabbar_background"];
        //选项卡图片
        NSArray *tabBarItemImages;
          //这里添加tabBar icon图片
        //= @[VString(@"First"), VString(@"Second"),VString(@"Third")];
    
        NSArray *tabBarItemTitles = @[@"Home", @"Found", @"Me"];
        NSInteger index = 0;
        for (RDVTabBarItem *item in [[self tabBar] items])
        {    //tabbarItem位置设置
            item.titlePositionAdjustment = UIOffsetMake(0, 2.0);
            [item setBackgroundSelectedImage:backgroundImage withUnselectedImage:backgroundImage];
            UIImage *selectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_selected",[tabBarItemImages objectAtIndex:index]]];
    
            UIImage *unselectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_normal",[tabBarItemImages objectAtIndex:index]]];
    
            [item setFinishedSelectedImage:selectedimage withFinishedUnselectedImage:unselectedimage];
    
            [item setTitle:[tabBarItemTitles objectAtIndex:index]];
            item.selectedTitleAttributes = @{
                                             NSFontAttributeName: [UIFont boldSystemFontOfSize:12],
                                             NSForegroundColorAttributeName:kNAVIGATION_BAR_COLOR,
                                             };
            item.unselectedTitleAttributes = @{
                                               NSFontAttributeName: [UIFont boldSystemFontOfSize:12],
                                               NSForegroundColorAttributeName:RGB(217, 217, 217),
                                               };
    
            [item setTitle:[tabBarItemTitles objectAtIndex:index]];
            index++;
    
        }
    }

    4.VString宏定义,为了就是更好的国际化语言,适配多语言,刚好此Demo也国际化了

    #define VString(x)      NSLocalizedString(x, nil)


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值