When I display the alert to the user, if he clicked on the OK button I need to move h开发者_如何转开发im to another screen, how can I do that:
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];
What you'll need to do is implement the UIAlertView delegate in the method you are using.
So if you have the class
@interface MyClass: UIViewController {
You'll want to change it to use
@interface MyClass:UIViewController <UIAlertViewDelegate> {
Then in the implementation file you just need to implement the method
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
From there you can move on.
精彩评论