I have root view that presents navigation controller with content controller, this is how it looks like:
NavigationController is presented modally, and ProjectTypeSelectionView is his root controller. When tapping logout button i want to dismiss modal view and return to LoginScreenViewController.
So i set in prepareSegue LoginScreen as delegate:
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
UINavigationController *destination = segue.destinationViewController;
if ([[destination ] respondsToSelector:@selector(setDelegate:)]) {
NSLog(@"%@", destination);
[destination setValue:self forKey:@"delegate"];
}
}
and then inside ProjectTypeViewController add this method:
- (IBAction)logout:(id)sender {
[self.delegate projectTypeSelectionViewControllerDidFinish];
}
which is called when logout button is tapped. To my suprise this doesn't dismiss controller. Nothing happens, even thou everything is connected.
I have traced error to this - when prepareSegue is called NavigationController's delagate is set to LoginScreenViewController, insetad of setting ProjectTypeController's delegate to LoginScreenViewController.
How do i solve this properly?