Reputation: 12210
Here's my problem. With Storyboard's segue I am having a popover segue for a bar button. The UIViewController inside the UIPopoverController requires to load the data from a server. With Storyboards, everytime I close the popover the view is released so whenever the popover appears again it tries to load data again from server. I dont want this behavior. How can I prevent Storyboard from resetting the view controller inside popover controller? Something like what UITabBarController does. UITabBarController calls viewDidLoad for the first time and for the subsequent tab switches viewWillAppear is called.
Upvotes: 1
Views: 1719
Reputation: 1442
Segue is designed so. Every time you do segue - view will be loaded. If you need to store it's data - you should store it outside popover and use this method
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
if ([[segue identifier] isEqualToString:@"your segue identifier"])
{
//get popover
ViewController *vc = [segue destinationViewController];
//Set popover data to vc here
}
which calls before segue, and in this method set data to popover. If you will use it - don't forget to set Segue identifier in Interface Builder.
Upvotes: 4