how to move to next view controller after showing alertview
iphone, xcode
Solution
Please use `UIAlertViewDelegate`
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
// Code to move to next view
[self moveToView];
}
Note: Implement the `UIAlertViewDelegate` in your interface Declaration. Also while declaring UIAlertView set the delegate to self.
Hope this helps you.
Problem
I have iPhone and I want that when `AlertView` is shown and user presses OK button after that view should be changed but it is not happening. ``` UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Thank you" message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; return; [self moveToView]; -(void)moveToView { MainViewController*targetController=[[MainViewController alloc]init]; [self.navigationController pushViewController:targetController animated:YES]; } ```