[英]pushViewController doesn't work after an Xcode 9 update
我使用的是xib而不是storyBord。 问题是当我想更改应用程序上的窗口时。 我可以加载下一个窗口,但我无法使用 pushViewController 显示它,我通知您在更新 Xcode 之前可以正常工作。
感谢您的回复
按钮点击方法:
`MesFic *vueMesFic=[[MesFic alloc] initWithNibName:@"MesFic" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:vueMesFic animated:YES];
[vueMesFic release];
vueMesFic=nil;`
我的 appDelegate.m
MyStyleSheet * myStyleSheetInstance = [[MyStyleSheet alloc] init];
[TTStyleSheet setGlobalStyleSheet:myStyleSheetInstance];
[myStyleSheetInstance release];
// Override point for customization after application launch.
//[self.window addSubview:[navigationController view]];
[self.window makeKeyAndVisible];
[window setRootViewController:navigationController];
return YES;
如果您正在使用 navigationController,请确保您已将 navigationController 设置为您的根控制器。
MyStyleSheet * myStyleSheetInstance = [[MyStyleSheet alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:myStyleSheetInstance];
[window setRootViewController:navigationController];
在这种情况下,您可以使用 self.navigation 进行导航
[self.navigationController pushViewController:vueMesFic animated:YES];
如果你不愿意使用 UINavigation,
MyStyleSheet * myStyleSheetInstance = [[MyStyleSheet alloc] init];
[window setRootViewController:myStyleSheetInstance];
然后使用
[self presentViewController:viewController animated:YES completion:nil];
它可能会帮助你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.