我有一个简单的UINavigationController,它通过自定义segue将UIViewController推送到堆栈.然后我在第一个UIViewController上实现了一个IBAction来执行一个展开动作,我实现了segueForUnwindingToViewController.不幸的是,没有调用segueForUnwindingToViewController(我确实确认在第一个VC上调用了canPerformUnwindSegue).
我没有看到任何这种行为的简单例子.有人可以帮忙吗?谢谢.
这是NavigationController的根视图控制器中的代码.
- (IBAction) unwindFromSegue:(UIStoryboardSegue *)segue { // unwinds back to here //[self performSegueWithIdentifier:@"UnwindToObjectManageSegue" sender:self]; } - (BOOL)canPerformUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)sender { return YES; } - (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender { return YES; } - (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController identifier:(NSString *)identifier { ObjectManageObjectDetailSegue *segue = [[ObjectManageObjectDetailSegue alloc] initWithIdentifier:identifier source:fromViewController destination:toViewController]; [segue setUnwinding:YES]; return segue; }