My main view controller is in a navigation controller and it conforms to EditViewControllerDelegate
protocol. It is the delegate of my two view controllers that I need to present modally.
@interface EditViewController : UIViewController
@property (nonatomic) id <EditViewControllerDelegate> delegate;
@end
@interface EditSomethingViewController : EditViewController
@end
@interface EditSomethingElseViewController : EditViewController
@end
In a editViewController:(EditViewController *)evc didFinishEditing:(Something *) something
method, I first get the data I need then I dismiss the evc
and call
[self performSegueWithIdentifier:@"My Segue" sender:self];
"My Segue" is defined in Xcode and the identifier is the same both in code and in Xcode (I tried to change it just to see if it gets called and it throws an exception)
When I change "My Seque"'s type to push, it worked. But with modal it doesn't do anything after I'm back to the main view controller
What am I missing?
EDITED:
I accidentally found out a warning in my storyboard! (it's weird because it's not a warning in the project "visible from everywhere") In the connections' inspector under "Referencing Storyboard Segues" there's a warning for my modal segue. it says :
(null) is not a valid containment controller key path
I checked other modal segues and there is the same warning, but I didn't need to trigger them by code so didn't have problems before.
EDITED 2:
-(void)editViewController:(EditViewController *) evc
didFinishEditing:(Something *) something
{
self.something = something;
[self dismissModalViewControllerAnimated:YES];
For ( OtherThing * otherThing in self.something.otherthingsArray)
{
NSLog(@"%@", otherThing);
}
[self performSegueWithIdentifier:@"My Segue" sender:self];
}