SWRevealViewController无法识别destinationViewController的扇区

时间:2015-08-25 16:21:37

标签: ios uiviewcontroller segue swrevealviewcontroller

我正在使用John Lluch的SWRevealViewController,它工作得很好,除了我无法弄清楚如何在目标视图控制器中设置选择器,就像我在其他UIViewControllers的segues中一样。

还有其他人遇到过这个问题吗?

这是我的代码:

- (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];

}

我在其他视图控制器的prepareForSegue中使用了此代码。选择器存在于目标TableViewController中,但SWRevealViewController在不执行的情况下传递if语句。

0 个答案:

没有答案