OGeek|极客世界-中国程序员成长平台

标题: iphone - 关于 UIAlert 跳转到一个 xib [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 17:09
标题: iphone - 关于 UIAlert 跳转到一个 xib

我有大约三个 xib 文件,a b c b上有一个按钮,点击它会显示警报,代码是

UIAlertView *alert = [[UIAlertView alloc] 
 initWithTitle"Warning"
 message"You will jump to a when you click 'Yes,Go',or click 'No,I am not' for exit" 
 delegate:nil 
 cancelButtonTitle"Yes,Go"
     cancelButtonTitle"No,I am not" 
 otherButtonTitles:nil];
 [alert show];
 [alert release];

正如它的描述,当我点击“Yes,Go”时我想跳转到a,如果我点击“No,I am not”,这个应用程序将被关闭

那该怎么办呢?

谢谢



Best Answer-推荐答案


您可以在警报 View 委托(delegate)中处理事件

- (void)alertViewUIAlertView *)alertView clickedButtonAtIndexNSInteger)buttonIndex

在这里检查按钮索引并做你想做的事。

关于iphone - 关于 UIAlert 跳转到一个 xib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5530573/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (https://ogeek.cn/) Powered by Discuz! X3.4