Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8558717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:52:32+00:00 2026-06-11T15:52:32+00:00

I am setting custom images for my UINavigationBar and UIToolbar using the following code:

  • 0

I am setting custom images for my UINavigationBar and UIToolbar using the following code:

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navigationBar"] forBarMetrics:UIBarMetricsDefault];
[[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:@"toolbar"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];

I am using PhotoViewer and pushing its view controller into view. It should have a translucent navigationbar and toolbar, but instead it uses the graphics I have supplied with translucency.

The problem is that later when I push in another view controller (after popping back to super from the PhotoViewer) its toolbar is also translucent which means the content sits behind it.

I have tried the following without luck:

[[UINavigationBar appearanceWhenContainedIn:[EGOPhotoViewController class], nil] setBarStyle:UIBarStyleBlackTranslucent];
[[UINavigationBar appearanceWhenContainedIn:[EGOPhotoViewController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
[[UIToolbar appearanceWhenContainedIn:[EGOPhotoViewController class], nil] setBarStyle:UIBarStyleBlackTranslucent];
[[UIToolbar appearanceWhenContainedIn:[EGOPhotoViewController class], nil] setBackgroundImage:nil forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];

Any ideas how I can achieve a black translucent barStyle just for the PhotoViewer and keep everything else with my custom graphics?

UPDATE: In an attempt to get some help, I’ve put together a sample project with a custom graphic for the navigation bar and then trying to display a pushed view controller with a translucent navigation bar without success when using the appearance proxy: EXAMPLE PROJECT

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:52:33+00:00Added an answer on June 11, 2026 at 3:52 pm

    I’ve downloaded your sample project and managed to fix it. I’ll explain what the problem is.

    First of all, the UINavigationBar is contained inside the UINavigationController. So, the RootViewController and the TranslucentViewController are using the same UINavigationBar instance. Perhaps this causes confusion. Also, that’s probably why the +appearanceWhenContainedIn: is not working as you expect.

    To set the background image of your navigation bars throughout your whole application, you should use +appearance. To set the background image of a single navigation bar in a navigation controller, use -setBackgroundImagE:forBarMetrics: of the UINavigationBar.

    The code: in -TranslucentViewController viewWillAppear: set the background image and the bar style. In RootViewController, set the background image and the bar style again. In my experience it’s the best to change the navigation bar in -viewWillAppear: instead of -in viewWillDisappear: (or you need to keep track of what to change it back to.)

    In RootViewController

    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
    
        [self.navigationController.navigationBar setBarStyle:UIBarStyleDefault];
        [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"orangeNavigationBar.png"] forBarMetrics:UIBarMetricsDefault];
    }
    

    In TranslucentViewController

    - (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
        [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
        [self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
    }
    

    Oh and: only change it in these place. Not when pushing the view controller or anything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I styled a UIBarButtonItem using Appearance API like the following [[UIBarButtonItem appearance] setBackgroundImage:barButtonBgImage forState:UIControlStateNormal
I'm having trouble setting a custom back button. Below is the current code I'm
I have four imageview in sequence on a screen setting with custom background images.
So, I'm using custom number tiles for images. The images are stored as resources.
I'm using a TabLayout and I have custom images for the tabs that I
I am currently using this code in my App Delegate to set a custom
I have some OBShaped/IrregularShaped custom buttons on the xib. I am setting the images
I'm setting a custom banner and dialog image for my WiX generated MSI. <WixVariable
Is there a MSBuild task for setting custom attribute in AssemblyInfo.cs? I found AssemblyInfo
I'm setting a custom StatusDescription in a RESTful WCF service when an exception is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.