I've been trying to make my pushed view controller dismiss or go back one once a confirm action has taken place. I read the many posts in stackoverflow on this subject (I've never done it before) e.g: How to perform Unwind segue programmatically?
but had quite some problems. First of all, the ctrl drag from view controller to exit, didn't work though that seems to be a bug in Xcode 6, so I added the following workaround as advised and changed the class back and forth:
@interface RequestLessonViewController ()
- (IBAction)unwindToMyViewController: (UIStoryboardSegue *)segue;
@end
This allowed me to add in the segue from my action button to Exit. I also of course gave it an identifier (unwindSegue
).
I then added the performWithSegueWithIdentifie
r line in my buttons code as follows:
- (IBAction)requestLessonAction:(UIButton *)sender {
// PUT CONFIRM POP UP IN HERE ???
NSLog(@"ADD A LESSON REQUEST TO LESSONS DATABASE");
UIAlertView *confRequest = [[UIAlertView alloc] initWithTitle:@"Lesson Request Submitted"
message:@"Congratulations"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[confRequest show];
[self performSegueWithIdentifier:@"unwindSegue" sender:self];
}
However my unwind is still not being kicked off.
Maybe this is still a problem due to xcode 6.4
and I need to use a different work around?
Anyway any help in this would be great
Thanks