1

I want to show a box and proceed with my code based on user's input. UIAlertView does not work as the application does not wait for the input. So is there another type of widget that can wait for user input and then pass control to the app ? I know there are duplicates here but they are not very helpful as I seem to be missing some pieces (completely new to objective c...)

user1845360
  • 847
  • 2
  • 12
  • 29

2 Answers2

1

you want a MODAL alert -- just use a UIAlertView and wait for its delegate before proceeding.

- a {
alert.delegate = self;
[alert show];
}

-alertView:(id)a didDismissWithButtonIndex:(int)i {
[self proceed]; 
}

- proceed {
... after alert ...
}
Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
1
-(void)function1{

...
// Add UIAlertView *alert; to .h file
alert = [[UIAlertView alloc] initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];

}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

if(alertView == alert && buttonIndex == 1){ // If yes
[self function2];
}
}

-(void)function2{

...
//Continue your task

}
Mohith
  • 96
  • 5