I am having an issue when I am pushing to a UIViewController by code from another UIViewController which has the same UINavigationController.
Notes & assumptions:
I have three classes in my UINavigation Controller:
Please find my code on the Dropbox link below: https://www.dropbox.com/sh/9m37y4f1gws99lf/VGNloaLSVO
When the "Show League Table" button is pushed in LTOverviewViewController I want the program to get the results from the filters & then immediately push to the LTResultsViewController.
With this code it pushes to the LTResultsViewController however the view appears to contain nothing. It is black with no UITable View & you cannot select anything.
In testing/debugging I created another button in LTOverviewViewController called "Push to Results" and connected it to LTResultsViewController as a push action in IB. It worked perfectly then when pushing the "Show League Table" button and then the "Push to Results" button, however I want it to happen without user having push that second button. Been stuck on this for days now so any help would be greatly appreciated!
Many thanks, James
With storyboards and segues this is fairly simple. In the storyboard, click on the connection between the UIViewController you want to transfer data between, I guess between LTOverviewViewController and LTResultsViewController, and give the segue an identifier name: say ResultsSegue.
Now, in the LTOverViewController, you need to implement this method:
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
In this method you will identify the segue name and the destinationViewController and pass the data you want the new view controller to have. Here is an example:
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"ResultsSegue"])
{
LTResultsViewController *viewController = [segue destinationViewController];
[viewController setData:self.data];
}
}
When the storyboard wants to use this particular segue, this method will be called and executed before moving on to the new viewController.