我从一个viewcontroller切换到另一个有问题。如何从一个UIViewController切换到另一个?
以下是我有:
在我的 “AppDelegate_iPad.m”:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
CGRect frame = [UIScreen mainScreen].bounds;
window = [[UIWindow alloc] initWithFrame:frame];
window.backgroundColor = [UIColor blackColor];
LoginViewController_iPad *loginView = [[LoginViewController_iPad alloc] initWithNibName:@"LoginViewController_iPad" bundle:nil];
[window addSubview:loginView.view];
[self.window makeKeyAndVisible];
return YES;
}
工程。现在我在该屏幕上有一个登录按钮,当按下它时,它就是这样的:
- (IBAction)doPressLoginButton
{
DebugLog(@"doPressLoginButton");
MenuViewController_iPad *menuView = [[MenuViewController_iPad alloc] initWithNibName:@"MenuViewController_iPad" bundle:nil];
[self.navigationController pushViewController:menuView animated:YES];
[menuView release];
}
问题是什么也没发生。我假设我错过了实际的导航调节器?!
希望,任何人都可以提供帮助。
谢谢
关于您对有关窗口是IBOutlet的评论。那么我知道,但我没有MainWindow.xib,所以我自己创建窗口。 – eemceebee 2011-01-09 11:29:36