[英]prepareForSegue never called
我正在使用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];
};
}
}
但是從側欄菜單中選擇項目時沒有任何反應。可能是什么問題?謝謝你的幫助。
我的錯,就是選擇“附件動作”而不是“選擇瞄准”“顯示視圖控制器”。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.