Tuesday, 15 January 2013

iphone - Custom UINavigationBar Height Issues -



iphone - Custom UINavigationBar Height Issues -

so i'm building ios application, , customized uinavigationbar taller default size. couple problems have arisen, however.

my content acts if uinavigationbar of default height. results in views @ y=0 hidden, or partially hidden, taller uinavigationbar. have manually place views right offset downward, isn't terribly huge issue, i'm curious whether has found way prepare this. uinavigationbar beingness treated normal 1 larger background image.

any views/buttons in uinavigationbar not tappable if portion beingness tapped below typical 44px bottom of normal uinavigationbar. within normal range works fine, below 44px mark doesn't register. again, it's if uinavigationbar beingness treated application 1 normal height big background image. much more critical issue need resolve.

here code modifies uinavigationbar:

[[uinavigationbar appearance] setbackgroundimage:[uiimage imagenamed:@"navbarbackground_iphone.png"] forbarmetrics:uibarmetricsdefault]; [self.navcontroller.navigationbar setbackgroundcolor:[uicolor whitecolor]]; [self.navcontroller.navigationbar setframe:cgrectmake(0, 0, self.frame.size.width, 72)];

this performed in main window's -makekeyandvisible after uinavigationcontroller allocated , initialized root view controller. background image 320px wide , 72px tall (double @2x version).

as can see, effort set uinavigationbar's height here, after portion of code doesn't seem stick. reverts 44px.

i've tried unsuccessfully subclass uinavigationbar. help appreciated.

try subclass uinavigationbar , override next method:

- (void)drawrect:(cgrect)rect { int heightyouwant = 100; uiimage *image = [uiimage imagenamed:@"title_bar_bg.png"]; [image drawinrect:cgrectmake(0, 0, self.frame.size.width, heightyouwant)]; self.tintcolor = [uicolor colorwithred:1/255.0 green:62/255.0 blue:130/255.0 alpha:1]; }

iphone ios objective-c height uinavigationbar

No comments:

Post a Comment