未调用prepareForSegue
我正在使用模板主详细信息应用程序。我从 SplitViewController 添加了一个模态转场,并为其指定了标识符“DisplayLoginView”。
我从我的detailViewController中调用以下内容:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:YES];
[self.splitViewController performSegueWithIdentifier:@"DisplayLoginView" sender:self.splitViewController];
}
我还在detailViewController中定义了prepareForSegue方法:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSLog(@"Source Controller = %@", [segue sourceViewController]);
NSLog(@"Destination Controller = %@", [segue destinationViewController]);
NSLog(@"Segue Identifier = %@", [segue identifier]);
if ([segue.identifier isEqualToString:@"DisplayLoginView"])
{
PrometheusLoginViewController *loginViewController = (PrometheusLoginViewController *)segue.destinationViewController;
loginViewController.delegate = self;
}
}
知道为什么不调用它吗?
I'm using the template master detail application. I have added a modal segue from SplitViewController and given it the identifier "DisplayLoginView".
I call the following from my detailViewController:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:YES];
[self.splitViewController performSegueWithIdentifier:@"DisplayLoginView" sender:self.splitViewController];
}
I also have the prepareForSegue method defined in detailViewController:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSLog(@"Source Controller = %@", [segue sourceViewController]);
NSLog(@"Destination Controller = %@", [segue destinationViewController]);
NSLog(@"Segue Identifier = %@", [segue identifier]);
if ([segue.identifier isEqualToString:@"DisplayLoginView"])
{
PrometheusLoginViewController *loginViewController = (PrometheusLoginViewController *)segue.destinationViewController;
loginViewController.delegate = self;
}
}
Any idea on why it's not called?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要求 splitViewController 执行 segue,但您在detailViewController 中定义prepareForSegue。它们需要位于同一对象上才能触发prepareForSegue。
You're asking the splitViewController to perform the segue, but you're defining prepareForSegue in the detailViewController. They need to be on the same object for prepareForSegue to be triggered.