After a UIAlertView is closed, I would like to reload a view (run viewWillDisappear for the view and viewWillAppear for the view).
How do I do that? I have tried delegating to both nil and self. Here is my code.
- (IBAction)doStuffWhenUIButtonIsClicked:(id)sender
{
int intSelection = [sender tag];
NSString* strAlertTitle;
NSString* strAlertMessage;
if (intSelection == self.intCorrectChoice) {
strAlertTitle = @"Correct tag!";
}
else {
strAlertTitle = @"Sorry, incorrect tag!";
}
strAlertMessage = @"The correct answer was 8.";
self.answerReaction = [[UIAlertView alloc]
initWithTitle: strAlertTitle
message: strAlertMessage
delegate: nil
cancelButtonTitle:@"Next Question"
otherButtonTitles:nil];
[self.answerReaction show];
}
As you see, I want to load a new question after the user answers one of them.
First, you need to make the view controller that you are in conform to the
UIAlertViewDelegateprotocol.Then, before you show the alert, you need to add this line:
Then, implement the didDismissWithButtonIndex delegate method:
That should take care of it!