Domanda

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?

È stato utile?

Soluzione

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

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top