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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:32:28+00:00 2026-05-26T14:32:28+00:00

I want to use my self background for my UIToolbar. To do that with

  • 0

I want to use my self background for my UIToolbar.

To do that with the UINavigationBar I’ve just used this category with the override of the drawRect method:

    @implementation UIToolbar (CustomImage)

    - (void)drawRect:(CGRect)rect {
         UIImage *image = [UIImage imageNamed: @"nm010400.png"];
         [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    }
    @end

This piece of code works perfectly for the UINavigationBar but this does not work for the UIToolbar that is inncluded in the UINavigationController and enabled with this line o code:

self.navController.toolbarHidden = NO;

Can anyone help me with the problem? I’ m sure that the UINavigationController use a standard UIToolbar so why this not works?!? thanks

  • 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-26T14:32:29+00:00Added an answer on May 26, 2026 at 2:32 pm

    To create custom UI elements there is no need to create categories anymore. With IOS 5 you can change the appearance of any UI element through the UIApperance protocol. You can change individual UI elements as normal but the real power comes when you are creating a themed application. Using this new protocol you can change the style of all instances of a particular UI element or even a UI element in a particular setting such as a UIBarButtonItem in a UINavigationController.

    To change the appearance of all of the UINavigationBars in your application you can set the background like so,

    [[UINavigationBar appearance]setBackgroundImage:[UIImage imageNamed:@"myNavBar.png"] forBarMetrics:UIBarMetricsDefault];
    

    you change different attributes depending on which element you are using to change the title attributes of the UINavigationBar you can use,

    [[UINavigationBar appearance] setTitleTextAttributes:
      [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor whiteColor], UITextAttributeTextColor, 
      [UIFont fontWithName:@"MarkerFelt-Thin" size:24], UITextAttributeFont, nil]];
    

    you can also use this on other UI elements so to change the background on all instances of the UIToolbar you can call

    [[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:@"myToolBar.png"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
    

    Hope this helps.

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

Sidebar

Related Questions

I have a numpy 2D array self.sub and i want to use it in
Tooday I use ServiceHost for self hosting WCF cervices. I want to host near
I want use this 1 for using Bar code or QR code scanner. I
I want to use Core Data in background threads and NSOperationQueue. Now I thought
I have a render loop that I want to run in the background so
I have a UITableViewController subclass that I want to use in conjunction with storyboards
I just want to prerender different images for fast access. I use grand central
I want to use UILabel in ContainerView. So I am using this code for
I have a button that, when selected, I want to use it to display
So i'm trying to use this method to load a certain theme based on

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.