我需要在单击按钮时从 rootviewcontroller 显示另一个视图。我已经编写了以下代码,但它不起作用。任何想法为什么?
在我的应用程序委托方法中,我有以下代码 -
- (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 = [[[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
然后在我的 mainviewcontroller 中,我有一个按钮操作,它应该带我去另一个班级,但它什么也没做。尽管按钮操作正在工作,因为 nslog 语句有效。有任何想法吗?
LoginViewController * loginViewController = [[LoginViewController alloc]initWithNibName:@"LoginViewController" bundle:nil];
[self.modalViewController presentModalViewController:loginViewController animated:YES];
NSLog(@"HE::P");