【发布时间】:2012-03-19 20:32:34
【问题描述】:
我正在使用最新的 SDK 和 XCode 4.2 开发一个 iOS 4 应用程序。
我正在使用 UINavigationController,但我不想显示导航栏。为此,我在 AppDelegate 上使用此代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];
}
else
{
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease];
}
navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
navController.navigationBar.hidden = YES;
self.window.rootViewController = navController;
[self.window makeKeyAndVisible];
return YES;
}
但是,navController.navigationBar.hidden = YES; 这一行不起作用。我在第一个视图控制器上看不到导航栏,但我在其他视图上看到它。
有什么线索吗?
【问题讨论】:
标签: ios cocoa-touch uinavigationcontroller