Je veux changer l'apparence de la barre de navigation, et jusqu'ici j'ai été en mesure de changer l'image de fond des barres de navigation, et aussi avec la couleur.changer les attributs de texte de la barre de navigation
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions {
//set the bg image of all nav bars
UIImage *navBackgroundImage = [UIImage imageNamed:@"navigationBackground.png"];
[[UINavigationBar appearance] setBackgroundImage:navBackgroundImage forBarMetrics:UIBarMetricsDefault];
return YES;
//customizing the title text of the nav bars
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:255.0/255.0 green:250.0/250.0 blue:240.0/240.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:@"Heiti TC" size:21.0], UITextAttributeFont, nil]];
}
C'est le code que j'ai utilisé pour changer l'image de la barre de navigation bg et la couleur. si vous regardez dans la 2ème déclaration d'apparition UINavigationBar, je tente de définir la police de la barre de navigation avec
[UIFont fontWithName:@"Heiti TC" size:21.0]
mais il ne sera pas changer la police. btw je cours ceci avec le simulateur d'iphone 6.1 sur xcode 4.6.2. Je suis sûr que le nom de la police est "Heiti TC".
Avez-vous essayé? http://stackoverflow.com/questions/10430298/how-to-set-font-color-of-the-title-in-uinavigationbar-using-ios5-appearance-ap – kap
toujours pas de go:/la police ne changera pas – Bradley114