关于Navigation的一些简单的设置

2016-03-01  本文已影响66人  Arxu

实现这样的效果,所有文字包括返回按钮都为白色

Paste_Image.png
- (void)changeNav
{
    //设置NavigationBar背景颜色
    [[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.1136 green:0.6474 blue:0.9986 alpha:1.0]];
    //@{}代表Dictionary
    [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    
    [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]} forState:UIControlStateNormal];
    
    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    
    //不设置这个无法修改状态栏字体颜色
    [[UINavigationBar appearance] setBarStyle:UIBarStyleBlack];
    
}

自定义返回按钮

记得要写在上一个页面上

UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:nil action:nil];  
self.navigationItem.backBarButtonItem = item;  

全局修改UINavigation 后退按钮

上一篇下一篇

猜你喜欢

热点阅读