How can I make my delegate method wait until, user makes a choice to the alertview confirmation?
BOOL userChoice = FALSE;
I have this delegate method:
-(BOOL) returnUserChoiceYESorNO:(NSString*)message { //delegate method
UIAlertView *msgBox = [[UIAlertView alloc] initWithTitle:@"Your Choice" message:message delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil]; [msgBox show]; [msgBox release];
//// HOW CAN I MAKE IT WAIT HERE, UNTIL I RECEIVE USER Responce from ClickedButtonAtIndex? (without using while loop or infinite loops)
return userChoice;
}
(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex==0) { userChoice = NO; else { userChoice = YES; }
}