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];
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With