I have a UITextField and save button when the user press save i want to popup an alert to confirm whether he want to save and wait for his response. But unfortunately it seems the alert view show doesnt stop execution or wait for user response. so how can i implement such a situation.
- (IBAction)Savebuttonaction:(UIButton *)sender
{
UIAlertView *view=[[UIAlertView alloc]initWithTitle:@"message" message:@"Do you want to save" delegate:self cancelButtonTitle:@"Yes" otherButtonTitles:@"No", nil];
[view show];
if(_isSaveConfirm)
NSLog(@"Saved");
else
NSLog(@"Not Saved");
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex==0)
{
_isSaveConfirm=YES;
}
else
{
_isSaveConfirm=NO;
}
}
please note i cannot write the further steps in the alertview delegate method. so please provide an alternate solution.