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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:26:12+00:00 2026-05-21T10:26:12+00:00

My problem is simple. I used the method of subclassing navigation bar, and then

  • 0

My problem is simple. I used the method of subclassing navigation bar, and then using drawRect to attempt to draw my own custom navigation bar image. However, it doesn’t draw my image… only a blank white space.

The structure of my project is a tab bar with a navigation controller under each one of it’s tabs. Each navigation controller has a navigation bar and I have set those bars to my custom class (customNavBar) in IB.

In my customNavBar.h file I have:

@interface customNavBar : UINavigationBar {
}

@end

In my customNavBar.m file I have:

#import "customNavBar.h"


@implementation customNavBar

-(void) dealloc{
    [super dealloc];
}


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

@end

Any ideas why my image might not be showing and instead just getting a white background? My image is in the project under the resources folder.

Thank you everyone. 🙂

  • 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-21T10:26:13+00:00Added an answer on May 21, 2026 at 10:26 am

    When I implemented your code in a test project, I did in fact see the image. I however did

    [image drawInRect:self.frame];
    

    The image ended up covering the bottom half of the nav bar and the top half was white (like you are seeing). Perhaps your image is being drawn too low? Try playing with the rect values or just set it to self.frame like I did and see what happens. If you still don’t see image, make sure your nav bar class is actual set to your custom class in interface builder and that code is being called to draw your nav bar (maybe put print statement be sure).

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

Sidebar

Related Questions

I'm new to Qt but no problem in the C++. I used Qt Creator
I'm new to OpenGL ES and having a simple kind of problem in my
I have a pretty simple HTML form where users can enter in information about
Here is my onCreate method: /** Called when the activity is first created. */
I'm learning C++ and can't get my head around this problem: I have a
I'm using Compact Framework 3.5 / VS2008. I'm getting really odd behavior with TypeLoadException.
I am new to both openGL and android development so please forgive me if
I'm working on a small simulation that is running on my 8-core workstation. The
I'm working with a huge table which has 250+ million rows. The schema is
A series of applications I'm writing require that the user be able to read

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.