所以,我开发了一个带有滑出式菜单的应用程序,我在那里使用了AppCoda(http://www.appcoda.com/ios-programming-sidebar-navigation-menu/)中的教程和项目文件。
这个滑出式菜单是由JSON从数据库创建的,并且正在按预期工作,但是,当我按下其中一个单元格时,它将不会加载新的ViewController。
我尝试过使用此代码,以使其正常工作:
- (void) prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
Rules *currentRule = [rulesArray objectAtIndex:indexPath.row];
UINavigationController *destViewController = (UINavigationController*)segue.destinationViewController;
destViewController.title = [currentRule.ruleTitle capitalizedString];
if ([segue.identifier isEqualToString:@"showRule"]) {
PhotoViewController *pvc = (PhotoViewController*)segue.destinationViewController;
pvc.people = currentRule.rulePeople;
pvc.content = currentRule.ruleText;
[self.navigationController pushViewController:pvc animated:YES];
}
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];
};
} }
结合两个视图的segue附加到TableView(菜单)和PhotoView。谁能看到我做错了什么?