Add Logo image to iphone globally across the Application
I need to show image(Logo) which is below the navigation bar in all my pages.
i am implementing
@implementation UINavigationBar (CustomImage)
(void)drawRect:(CGRect)rect
{
UIImage *image = [UIImage imageNamed: @"logo.png"];
[image drawInRect:CGRectMake(self.fr开发者_Python百科ame.size.width/2, 40, 89, 42)];
}
in appdelegate
it won't work out .Is this possible to use image globally or any other better way?Add this in AppDelegate.m file
-(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];
}
Add this in AppDelegate.h file
UINavigationController *navigationController;
:)
精彩评论