我正在使用SWRevealViewController来构建侧栏菜单。 从菜单(UITableView)中选择元素时,我有这种方法来选择正确的控制器。 segue标识符/名称在故事板中配置。
- (void) prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender
{
NSLog(@"Tapped");
// Set the title of navigation bar by using the menu items
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
UINavigationController *destViewController = (UINavigationController*)segue.destinationViewController;
destViewController.title = [[_menuItems objectAtIndex:indexPath.row] capitalizedString];
// Set the photo if it navigates to the PhotoView
if ([segue.identifier isEqualToString:@"showToday"]) {
[segue destinationViewController];
}
if ([segue.identifier isEqualToString:@"showCountries"]) {
[segue destinationViewController];
}
if ( [segue isKindOfClass: [SWRevealViewControllerSegue class]] ) {
SWRevealViewControllerSegue *swSegue = (SWRevealViewControllerSegue*) segue;
swSegue.performBlock = ^(SWRevealViewControllerSegue* rvc_segue, UIViewController* svc, UIViewController* dvc) {
UINavigationController* navController = (UINavigationController*)self.revealViewController.frontViewController;
[navController setViewControllers: @[dvc] animated: NO ];
[self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];
};
}
}
但是从侧栏菜单中选择项目时没有任何反应。可能是什么问题?谢谢你的帮助。
答案 0 :(得分:2)
我的错,选择“附件动作”而不是“选择瞄准”“显示视图控制器”。