@ Odpowiedź RyJ jest świetna i zadziałała dla mnie. Pomyślałam, że chip, że nie jest to dobre wprowadzenie do tego w miejscu Ray Wenderlich w pt (wybaczcie kalambur):
User Interface Customization in iOS 6
Patrz sekcja Dostosowywanie UINavigationBar
Oto fragment kodu dla tytuł pasek nawigacyjny, aby zmienić globalnie:
// Customize the title text for *all* UINavigationBars
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0],
UITextAttributeTextColor,
[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8],
UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)],
UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"Arial-Bold" size:0.0],
UITextAttributeFont,
nil]];
Jeszcze jedna drobna uwaga jest to, że wydaje się, że jest to domyślny cień na pasku tytułowym, tak aby pozbyć się go, nie możesz po prostu usunąć tego atrybutu. Zamiast tego musisz ustawić przesunięcie cienia:
UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetMake(0, 0)]
Powinieneś zaakceptować własną odpowiedź. –
bardzo pomocne .. dzięki –
Działa dobrze. Jeśli trzeba także ustawić motyw do aktywnego UINavigationBar, dodać linię: '[yourViewController.navigationController.navigationBar setTitleTextAttributes: textTitleOptions]' –