火山

立志做一名优秀的软件工程师,在技术上追求一专多能,在思想上追求与时具进。...

iOS 自定义nav tab 样式

//状态栏颜色
        [[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];
阅读更多
文章标签: ios
个人分类: iOS开发
上一篇iOS Tabbar上增加一个自定义按钮
下一篇iOS 列表折叠效果
想对作者说点什么? 我来说一句

ios模仿新闻类app的tab样式

2017年04月19日 813KB 下载

没有更多推荐了,返回首页

关闭
关闭