我一直在 Internet 上寻找解决这个问题的方法,但没有找到我能理解的方法。所以就这样了。 我有我的 iOS 应用程序,在应用程序首次启动时,它会显示一个 UIAlertView。我想要其中一个按钮将用户发送到新的 viewController 以查看一些基本信息。
我已经正确配置了我的 UIAlertView,下面是 actionSheet 的代码:
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0)
{
//Code to open a new viewController???
}
if (buttonIndex == 1)
{
//User can exit the application if they do not wish to continue
exit(0); }
}
}
我创建了一个名为 webViewViewController 的 viewController,这就是我希望用户在点击第一个按钮时到达的内容。关于如何做到这一点的任何想法?我禁用了 ARC,我遇到的其他“解决方案”一直给我错误。
谢谢大家,希望能在这里提供一些指导。
最佳答案
如果您当前的 View Controller 在导航 Controller 中:
UIViewController *myViewController = [[UIViewController alloc] init];
myViewController.title = @"My First View";
//to push the UIView.
[self.navigationController pushViewController:myViewController animated:YES];
永远不要使用 exit(0)!
关于objective-c - UIAlertView 按钮显示 viewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14437975/