I am using John Lluch's SWRevealViewController which works great, except I cannot figure out how to set selectors in the destination view controller as I do in segues for other UIViewControllers.
Has anyone else encountered this problem?
Here is my code:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Set the title of navigation bar by using the menu items
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
UINavigationController *destViewController = (UINavigationController*)segue.destinationViewController;
if ([segue.identifier isEqualToString:@"goalSegue"]) {
if ([segue.destinationViewController respondsToSelector:@selector(setTitleForViewController:)]) {
// use performSelector:withObject: to send without compiler checking
// (which is acceptable here because we used introspection to be sure this is okay)
NSString * titleText = @"Athlete Goals";
[segue.destinationViewController performSelector:@selector(setTitleForViewController:) withObject:titleText];
} else destViewController.title = [[menuItems objectAtIndex:indexPath.row] capitalizedString];
} else destViewController.title = [[menuItems objectAtIndex:indexPath.row] capitalizedString];
}
I have used this code in prepareForSegue in other view controllers. The selector exists in the destination TableViewController, but SWRevealViewController passes over if-statement without executing.