我需要在所有页面的导航栏下方显示图像(徽标)。
我正在实施
@implementation UINavigationBar (CustomImage)
(void)drawRect:(CGRect)rect
{
UIImage *image = [UIImage imageNamed: @"logo.png"];
[image drawInRect:CGRectMake(self.frame.size.width/2, 40, 89, 42)];
}
答案 0 :(得分:0)
在AppDelegate.m文件中添加
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
[self.window addSubview:navigationController.view];
UIImageView * mImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@“apple_small_icon”]];
[mImage setFrame:CGRectMake(270,5,35,35)];
[navigationController.navigationBar addSubview:mImage];
[mImage release];
}
在AppDelegate.h文件中添加
UINavigationController * navigationController;
:)