Frage

In the application delegate within my application I call the following method:

- (void)customizeAppearance 
{
    UIImage *gradientPortrait = [[UIImage imageNamed:@"gradient_portrait"] 
        resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];

    UIImage *gradientLandscape = [[UIImage imageNamed:@"gradient_landscape"] 
        resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];

    [[UINavigationBar appearance] setBackgroundImage:gradientPortrait 
        forBarMetrics:UIBarMetricsDefault];
    [[UINavigationBar appearance] setBackgroundImage:gradientLandscape 
        forBarMetrics:UIBarMetricsLandscapePhone];
}

This code allow to customize all the navigation bars within the application. Each bar becomes green since the image I use is green.

Now my goal is to ovveride the above configuration for a specific navigation bar. In particular, during application lifecycle, I open a modal controller using UIModalPresentationFormSheet presentation style. This controller is presented within a UINavigationController. Since I need also to display the navigation bar attached with that UINavigationController, I would like to know how it is possible to customize that bar, without changing the global configuration I set in the application delegate.

I've tried to set both the tintColor property of the navigation bar (presented modally) to [UIColor blackColor] and the barStyle to UIBarStyleBlack, but they don't work. Only barbutton items are affected.

Thank you in advance.

P.S. I'm using iOS 5

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top