- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:self.viewController];
// CHANGE COLOR TO BLACK
nav.navigationBar.tintColor = [UIColor blackColor];
// ADDING IMAGE TO NAVIGATION BAR
UIImage *image = [UIImage imageNamed:@"logo_36.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[nav.navigationBar.topItem setTitleView:imageView];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
return YES;
}
我已经在 appdelegate 类中尝试过这段代码,因为我想要在整个项目中使用它,它适用于显示图像,但它显示在中心也我需要我无法显示的文本。
请有人建议我如何在iOS导航栏的左侧显示图像和文本