objective c - Issues with changing UINavigationBar background when presenting modal view controller -


i using this method change backgrounds of uiviewcontrollers. works when push view controller.

however, if viewcontroller presented using

[self presentmodalviewcontroller:customviewcontroller animated:yes]; 

then, code doesnt work. can kindly suggest whats wrong ?

code used:

to have image in navigation bar, have draw yourself, isn't hard. save uinavigationbar+custombackground.m (it adds custom category uinavigationbar):

@implementation uinavigationbar (custombackground)  - (void)drawrect:(cgrect)rect { uiimage *image = [uiimage imagenamed:@"navmain.png"]; [image drawinrect:cgrectmake(0, 0, self.frame.size.width, self.frame.size.height)]; }  @end 

if running on ios 5, drawrect: no longer called

you need either use uiappearance or subclass uinavigationcontroller , use change image.

a tutorial uiappearance can found here

(drawrect: still work on versions below ios 5)


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -