IOS学习之 导航栏

iOS7下改变UINavigationBar颜色

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {        
        // Load resources for iOS 6.1 or earlier        
self.navigationController.navigationBar.tintColor = [UIColor brownColor];    
} else {        
        // Load resources for iOS 7 or later       
 self.navigationController.navigationBar.barTintColor = [UIColor brownColor];    
}

 修改title的字体颜色

[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];


barButtonItem的背景颜色

 UIBarButtonItem* backItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon_back_menu"] style:UIBarButtonItemStyleDone target:self action:@selector(back:)];

    backItem.tintColor = [UIColor whiteColor];

    self.navigationItem.leftBarButtonItem = backItem;


隐藏导航栏

self.navigationController.navigationBarHidden = YES;


你可能感兴趣的:(ios,导航栏)