如何隐藏导航栏?

时间:2012-07-05 03:24:52

标签: iphone objective-c navigationbar

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil] autorelease];
    self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    return YES;

2 个答案:

答案 0 :(得分:0)

设置navigationBarHidden属性以隐藏导航栏。有关参考,请参阅UINavigationController文档。将以下语句添加到didFinishLaunchingWithOptions方法中。

[self.navigationController setNavigationBarHidden:YES animated:YES];

答案 1 :(得分:0)

尝试此操作以删除导航栏。

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 
   // Override point for customization after application launch. 
   MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil] autorelease]; 
   self.window.rootViewController = masterViewController; 
   [self.window makeKeyAndVisible]; return YES;
}