Question

For example, I have a method:

- (void)customizeAppearance
{
[[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]];
}

How can I make so that this method worked for whole applications?

Était-ce utile?

La solution

If you put this code in your app delegate in the finished lunching method that will effect all the app.

Pay attention that this will work only on iOS 5

Autres conseils

If you use this within a UIViewController just create your own subclass MyUIViewController and you may use it in every new screen you create. Just use MyUIViewController as your screen's superclass instead of the normal UIViewControler.

In general, this is a good idea, since you can easily add other behaviours to all your screens by only having to change code in your MyUIViewController.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top