objective c - Iphone Custom Navigation Bar - White Box Error -


my problem simple. used method of subclassing navigation bar, , using drawrect attempt draw own custom navigation bar image. however, doesn't draw image... blank white space.

the structure of project tab bar navigation controller under each 1 of it's tabs. each navigation controller has navigation bar , have set bars custom class (customnavbar) in ib.

in customnavbar.h file have:

@interface customnavbar : uinavigationbar { }  @end 

in customnavbar.m file 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 image might not showing , instead getting white background? image in project under resources folder.

thank everyone. :)

when implemented code in test project, did in fact see image. did

[image drawinrect:self.frame]; 

the image ended covering bottom half of nav bar , top half white (like seeing). perhaps image being drawn low? try playing rect values or set self.frame did , see happens. if still don't see image, make sure nav bar class actual set custom class in interface builder , code being called draw nav bar (maybe put print statement sure).


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -