實現這樣的效果,所有文字包括返回按鈕都為白色
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;