2014-01-10 136 views
1

我的應用中的導航欄有白色文本,當用戶打開地址簿時,它應該是普通顏色(藍色文本)。我嘗試在推送地址簿視圖之前更改文本顏色,但標題(組,取消)仍爲白色。我怎麼解決這個問題?任何幫助表示讚賞。地址簿顏色已更改

編輯:中間的標題(所有聯繫人)就像默認的黑色。
我已經嘗試過

self.navigationController.navigationBar.tintColor = [UIColor blueColor]; 
self.navigationItem.rightBarButtonItem.tintColor = [UIColor blueColor]; 
self.navigationItem.leftBarButtonItem.tintColor = [UIColor blueColor]; 

推動地址簿查看過,但沒有奏效。
我也試過

[picker.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor blueColor] forKey:NSForegroundColorAttributeName]]; 
picker.navigationController.navigationBar.tintColor = [UIColor blueColor]; 
picker.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor blueColor] forKey:NSForegroundColorAttributeName]; 

但這些沒有工作也沒有。

修正了

[[UIBarButtonItem appearance] setTintColor:nil]; 
+0

問題也許這個帖子可能是有用的 http://stackoverflow.com/questions/599405/iphone-navigation-bar-title-text-color –

+0

他們想要更改該帖子中的默認顏色,但我只想要默認顏色。 – user2414460

回答

0
UINavigationController *nac = [[[UINavigationController alloc] initWithRootViewController:addBookViewController]autorelease]; 
NSDictionary *textAttributes = [NSDictionary dictionaryWithObjectsAndKeys: 
           [UIColor whiteColor],NSForegroundColorAttributeName, 
           [UIColor whiteColor],NSBackgroundColorAttributeName,nil]; 

nac.navigationBar.titleTextAttributes = textAttributes; 
[nac.navigationBar setTintColor:[UIColor whiteColor]]; 
+0

我沒有AddressbookViewController。我用 'ABPeoplePickerNavigationController * picker = [[ABPeoplePickerNavigationController alloc] init]; \t picker.peoplePickerDelegate = self; [self presentViewController:picker animated:YES completion:nil];' – user2414460

+0

ABPeoplePickerNavigationController是UINavigationController的子類。嘗試picker.navigationBar.titleTextAttributes = textAttributes; [picker.navigationBar setTintColor:[UIColor whiteColor]]; – chrios

+0

我自己修復了。查看我的問題中的更新 – user2414460