I am using this method to change the backgrounds of my uiviewcontrollers. It generally works when I push a view controller.
However, if the viewcontroller is presented using
[self presentModalViewController:customViewController animated:YES];
then, this code doesnt work. Can anyone kindly suggest whats wrong ?
Code used:
To have an image in the navigation bar, you have to draw it yourself, which actually isn't that hard. Save this as UINavigationBar+CustomBackground.m (it adds a custom category to 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