[英]How to exit the program after detecting user clicked the OK button on the UIAlertView
在我的程序中,我有以下代码。 在检测用户后如何在UIAlertView上单击OK
退出程序?
谢谢
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"YOur Message" message:@"Your description"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
[alert release];
为了获得取消(您的“确定”)按钮,请执行以下方法:
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 0)
exit(0);
}
在此处检查质量检查。 看到这个教程
如果需要,请使用exit(0);
将AlertView委托设置为self。 并完成以下任务,
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
要捕获确定,请使用以下命令:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
exit(0);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.