【发布时间】:2012-03-20 04:12:43
【问题描述】:
我正在使用this 方法来更改我的uiviewcontrollers 的背景。它通常在我推送视图控制器时起作用。
但是,如果视图控制器是使用
[self presentModalViewController:customViewController animated:YES];
然后,此代码不起作用。任何人都可以提出什么问题吗?
使用的代码:
要在导航栏中显示图像,您必须自己绘制它,这实际上并不难。将其另存为 UINavigationBar+CustomBackground.m(它向 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
【问题讨论】:
-
你试过了吗:[self.navigationController presentModalViewController:customViewController animated:YES];
标签: objective-c ios uinavigationbar