目标c-通过应用程序在全球范围内为iphone添加徽标图像



我需要在所有页面的导航栏下面显示图像(徽标)。

我正在实施

 @implementation UINavigationBar (CustomImage)  
 (void)drawRect:(CGRect)rect 
 {  
     UIImage *image = [UIImage imageNamed: @"logo.png"];  
     [image drawInRect:CGRectMake(self.frame.size.width/2, 40, 89, 42)];  
 }    

在appdelegate中
它不会成功的。这是否可以全局使用图像或其他更好的方式?

将其添加到AppDelegate.m文件

-(BOOL)应用程序:(UIApplication*)应用程序didFinishLaunchingWithOptions:(NSDictionary*)launchOptions

navigationController=[[UINavigationController alloc]initWithRootViewController:viewController]
[self.window-addSubview:navigationController.view]
UIImageView*mImage=[[UIImageView alloc]initWithImage:[UUIImage imageNamed:@"apple_small_icon"]]
[mImage setFrame:CGRectMake(270,5,35,35)]
[navigationController.navigationBar addSubview:mImage]
[mImage发布]
}

将其添加到AppDelegate.h文件

UI导航控制器*导航控制器;

:)

最新更新