I have a small app that uses multiple section layouts for the initial table view. One section displays the most recent trends from Twitter and the other section displays the most recent stories from Twitter. When I click on an item within the list of trends I transition to a new table view controller that displays the most recent tweets about that trend. Within the root controller for the stories section I wat to be able to display more information in a different view controller that contains images, links, and so forth. The problem is that when I select anything within the stories section, I am being pushed to the table view controller that is set up for the trends section. I have named each segue and have custom classes for both of the views that I want to transition to and I am doing this to check which segue is being called:
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([[segue identifier] isEqualToString:@"viewTrendsSearch"]) {
//get the controller that we are going to segue to
SearchTrendResultsViewController *strvc = [segue destinationViewController];
//get the path of the row that we want from the table view
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
//here we get the trend object from the array we set up earlier to hold all trends
Trends *results = [currentTrends objectAtIndex:[path row]];
//pass the object that was selected in the table view to the destination view
[strvc setQuery: results];
}
if([[segue identifier] isEqualToString:@"storyfullDetails"]) {
StoriesViewController *svc = [segue destinationViewController];
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
Stories *results = [currentStories objectAtIndex:[path row]];
[svc setStory:results];
}
}
Any suggestions on how to get to the different views?