[英]Presenting Modal View Controller in iOS not working
我需要在按钮点击时显示rootviewcontroller的另一个视图。 我写了下面的代码,但它不起作用。 有什么想法吗?
在我的app委托方法中,我有以下代码 -
- (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");
如果你试试 :
[self presentModalViewController:loginViewController animated:YES];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.