自定义导航条的颜色

来源:互联网 发布:汇付数据 编辑:程序博客网 时间:2024/05/21 10:36
自定义导航条的样式
- (void)setupNavigationBarStyle {        UINavigationBar *appearance = [UINavigationBar appearance];    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {                // 设置导航条背景颜色,在iOS7才这么用        [appearance setBarTintColor:[UIColor colorWithRed:0.291 green:0.607 blue:1.000 alpha:1.000]];        // 设置导航条的返回按钮或者系统按钮的文字颜色,在iOS7才这么用        [appearance setTintColor:[UIColor whiteColor]];        // 设置导航条的title文字颜色,在iOS7才这么用        [appearance setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:                                            [UIColor whiteColor], NSForegroundColorAttributeName, [UIFont systemFontOfSize:17], NSFontAttributeName, nil]];            } else {        // 设置导航条的背景颜色,在iOS7以下才这么用        [appearance setTintColor:[UIColor colorWithRed:0.291 green:0.607 blue:1.000 alpha:1.000]];    }}


0 0
原创粉丝点击