当我向用户显示警报时,如果他单击“确定”按钮,我需要将他移动到另一个屏幕,我该怎么做:
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"TopStation"
message :@"Your internet connection is down, you will be redirected to the previous screen"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
最佳答案
您需要做的是在您使用的方法中实现 UIAlertView 委托(delegate)。
所以如果你有课
@interface MyClass: UIViewController {
您需要将其更改为使用
@interface MyClass:UIViewController <UIAlertViewDelegate> {
然后在实现文件中你只需要实现方法
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
从那里你可以继续前进。
关于ios - 当用户点击 UIAlertView 的 OK 按钮时移动到另一个 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6047156/