关闭

iOS 自定义nav tab 样式

标签: ios
532人阅读 评论(0) 收藏 举报
分类:
//状态栏颜色
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];


        // 定义NavigationBar样式
        [[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName:kFont_Nav_Title,NSForegroundColorAttributeName:kColor_White}];
        [[UINavigationBar appearance] setTintColor:kColor_White];
        [[UINavigationBar appearance] setBackgroundImage:[UICommonCtrl imageWithColor:kColor_Blue] forBarMetrics:UIBarMetricsDefault];
        [[UINavigationBar appearance] setShadowImage:[UICommonCtrl imageWithColor:kColor_Blue]];

        //自定义返回按钮
        UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, -2.0, 0);
        UIImage *alignedImage = [[UIImage imageNamed:@"icon_nav_back"] imageWithAlignmentRectInsets:insets];
        [[UINavigationBar appearance] setBackIndicatorImage:alignedImage];
        [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:alignedImage];
        [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
                                                             forBarMetrics:UIBarMetricsDefault];

       // 定义TabBar样式
        [[UITabBar appearance] setTintColor:kColor_Blue];
        [[UITabBar appearance] setShadowImage:[UICommonCtrl imageWithColor:SHORTCOLOR(0xe4)]];
        [[UITabBar appearance] setBackgroundImage:[UICommonCtrl imageWithColor:kColor_White]];

        [[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName : kColor_Blue }
                                                 forState:UIControlStateSelected];
        [[UITabBarItem appearance] setTitleTextAttributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:11] }
                                                 forState:UIControlStateNormal];
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:269809次
    • 积分:5678
    • 等级:
    • 排名:第4802名
    • 原创:304篇
    • 转载:10篇
    • 译文:0篇
    • 评论:84条
    最新评论