I've made an app using iOS6 unwind segues not realising they weren't in iOS5 and so i'm taking it apart in order to support iOS5. So far i've worked out that I need to use delegates in order to get information back to my root view from the modal segue view and have a couple of good examples to follow and i'm quietly confident I get it.
Currently the modal segue is generated via the storyboard however, not via code.
In order to set it's delegate as my root view will I need to generate it via code instead or is there a way via the storyboards?
Before performing the segue the program will call the method - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
in the sourceViewController (the view controller that calls the segue). In this method you can give the destinationViewController a reference to self:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
[segue.destinationViewController setDelegate:self];
}
Of course you need the property in the destinationViewController:
@property (weak, nonatomic) id<yourProtocol> delegate;
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With