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

  • Home
  • SEARCH
  • 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 6801317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:05:07+00:00 2026-05-26T19:05:07+00:00

I am having troubles after updating to Xcode 4.2. Before I used the following

  • 0

I am having troubles after updating to Xcode 4.2.
Before I used the following codes for making custom navigation bar, but when i use iPhone 5.0 simulator, it fails whereas in iPhone 4.2 simulator it was ok.

May I know what is the problem and how can i fix this?

Many thanks

@implementation UINavigationBar (UINavigationBarCustomDraw)
- (void) drawRect:(CGRect)rect {

   [self setTintColor:[UIColor colorWithRed:0.4f
                                    green: 0.0f
                                     blue:0.4f 
                                    alpha:1]];

   if ([self.topItem.title length] > 0 && ![self.topItem.title isEqualToString:@""]) 
   {
        [[UIImage imageNamed:@"purple.jpg"] drawInRect:rect];   
   }
}

@end
  • 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-26T19:05:08+00:00Added an answer on May 26, 2026 at 7:05 pm

    If you need custom UINavigationbar with some image so you need to put this code in rootViewController that is first view of navigate stack (A > B > C , so you have to put this in A)

    - (void)viewDidLoad
    {
      [super viewDidLoad];
    
      [[UIDevice currentDevice] systemVersion];
    
      if ([[[UIDevice currentDevice] systemVersion] floatValue] > 4.9) {
    
          //iOS 5
          UIImage *toolBarIMG = [UIImage imageNamed: @"purple.jpg"];  
    
          if ([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) { 
             [[UINavigationBar appearance] setBackgroundImage:toolBarIMG forBarMetrics:UIBarMetricsDefault]; 
          }
    
          } else {
    
          //iOS 4
          [self.navigationController.navigationBar insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"purple.jpg"]] autorelease] atIndex:0];  
           }
       }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an AJAX PHP upload script, but I am having troubles. After
I'm having trouble to change size of fielddefs in a TClientDataSet after i use
I'm having some troubles with my Rails app after installing (and removing) Compass. bundle
I'm having troubles logging in to PhpMyAdmin. When I press login after typing in
I'm trying to get started using git, but I'm having some troubles right away.
I am having troubles inserting entities in linq after deleting them (without submitting the
I'm having trouble getting a JLabel to display text immediately before updating it with
I'm having troubles finding a class name after extending other classes. Here are the
I am having troubles comparing objects In entity Framework 4.0. After googling for a
I've created a DLL function for using inside C# using DLLImport but having troubles

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.