我在界面生成器中创建了一个UIView。我在其中有一个按钮。我可以通过点击UIView的按钮来加载应用程序中的任何ViewController吗?我的UIView不在导航控制器下。
您可以使用NSNotification通知ViewController呈现另一个ViewController。
更多信息请点击此处:
NSNotificationCenter类别参考
使用以下项显示ViewController:
ViewController *viewController = ...;
[self presentViewController:viewController animated:YES completion:NULL];
另一种选择是,通过按钮调用代理。
你可以这样做
YourViewController *aView = [[YourViewController alloc]
initWithNibName:@"xibName" bundle:nil];
[self presentViewController:aView animated:YES completion:nil];