I tried several answers on this site, but none of them seem to concern my problem.
I have a MasterDetail application that uses two types of segues that I use. When you click on a button in the detail view, it uses push segue and clicks on it another detailed view. In the new detailed view (the one that was just clicked) there is a button that calls another UIView (form sheet) using a modal segment.
What I'm trying to do is when the user selects a row, the UIAlertView will display the message, and at the same time (should not be at the same ) it rejects the UIViewcontroller (modal) and returns from the Viewcontroller that was clicked. Basically, I need to remove all view controllers, one modal and one push (nav), so that the view returns to the original main screen from which they started.
UIAlertView works for me, and I can disable the modal viewcontroller using [self.dismissViewControllerAnimated:YES completion:nil]; but I donβt know how to reject the next Viewcontroller (which is in the navigation controller). Using this: [self.navigationController popToRootViewControllerAnimated:NO]; does not work.
Here I want to call a function to remove all views:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlWithIDAndChallenge]; NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self]; UIAlertView *message = [[UIAlertView alloc] initWithTitle@ "Started" message:@"The challenge has begun!" delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles:nil]; [message show]
source share