美文网首页
关于Navigation的一些简单的设置

关于Navigation的一些简单的设置

作者: Arxu | 来源:发表于2016-03-01 16:48 被阅读66次

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

    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 后退按钮

    相关文章

      网友评论

          本文标题:关于Navigation的一些简单的设置

          本文链接:https://www.haomeiwen.com/subject/qhtnkttx.html