我正在使用故事板,我基本上有这个:
它是一个 mapView,它以模态方式呈现一个 UINavigationController,其中一个 UIViewController 子类作为它的 contentViewController(位置)。然后,该 LocationViewController 根据表选择(EditLocation)推送另一个 viewController。
在 EditLocation 中,我想在调用 popViewController 时传回信息。我认为我可以使用 UINavigationControllerDelegate 来做到这一点。所以在位置,我尝试:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"ShowEditLocation"]) {
UIViewController *destination = segue.destinationViewController;
if ([destination respondsToSelector:@selector(setDelegate:)]) {
[destination setValue:self forKey:@"delegate"];
}
}
}
此 Location 类符合 UINavigationControllerDelegate 协议。但是,我从未从 UINavigationController 协议中获得 willShowViewController 或 didShowViewController 回调。想法?谢谢!