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 6940795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:47:57+00:00 2026-05-27T12:47:57+00:00

I need to support iOS4 and iOS5. My code works well on iOS4, but

  • 0

I need to support iOS4 and iOS5. My code works well on iOS4, but don’t work on iOS5. How to fix the problem.

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"E_44.png"]];
imageView.frame = CGRectMake(136, 0, 52, 44);
[self.navigationController.navigationBar insertSubview:imageView atIndex:0];
[imageView release];
  • 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-05-27T12:47:57+00:00Added an answer on May 27, 2026 at 12:47 pm

    Setting custom background for UINavigationBar to support iOS5 and iOS4 too!


    As you know, until iOS 5 came out, we used drawRect override in AppDelegate to customize UINavigationBar.
    But know, iOS 5 give us some new method for styling (and old doesn’t work).

    How to build app that will work on iOS 4 and iOS 5 with stylized UINavigationBar?

    You must to do both!

    In AppDelegate use this code:

    @implementation UINavigationBar (UINavigationBarCategory)
    - (void)drawRect:(CGRect)rect {
    UIImage *img = [UIImage imageNamed:@"navbar.png"];
    [img drawInRect:rect];
    }
    @end
    

    and in viewDidLoad method for iOS5 (in your view implementation):

    if ([self.navigationController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)]){
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navbar.png"] forBarMetrics:UIBarMetricsDefault];
    }
    

    If you see, here we are asking if navbar will respondToSelector to avoid crash on iOS4!

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

Sidebar

Related Questions

I need to support Chinese in one of my application on Windows, the problem
Im using the jQuery dynamic form plugin , but i need support for nested
I need to support retina display but the app size has to be small.
I have developed an iPhone application which should support iOS4 and iOS5 based iPhone/iPad.
I just started using jqModal as I need support for nested modals. I'm noticing
Since i'm a poor sql developer, i need support to write a sql query
I need to support exact phrases (enclosed in quotes) in an otherwise space-separated list
In a current project I need to support finding a User by login credentials
I have been given a requirement where I need to support multiple databases in
I am creating a multilingual site that will need to support at minimum five

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.