【问题标题】:Segue is using the wrong animationSegue 使用了错误的动画
【发布时间】:2012-07-27 22:30:27
【问题描述】:

我正在使用 push segue 从视图控制器进入动画控制器。我的故事板文件中有一个 push segue,这是我在 prepareForSegue 方法中使用的代码:

if([[segue identifier] isEqualToString:@"Push To Table Segue"]){
     NSLog(@"Push to table segue called");

    ReccyTableViewController *loginViewController = (ReccyTableViewController *)segue.destinationViewController;

    [self presentViewController:loginViewController animated:YES completion:nil];
}

这是调用下一个segue的代码:

- (void)goToNextView {
      [self performSegueWithIdentifier:@"Push To Table Segue" sender:self]
}

segue 有效,但新窗口从底部向上飞,而不是被推动。我怎样才能让它推入?

【问题讨论】:

    标签: iphone ios user-interface segue


    【解决方案1】:

    好吧,在为 segue 做准备时,您应该只“准备”,而不是执行动画。

    另外,这里使用的不是你的segue动画,而是presentViewController的动画,我认为默认是模态动画。您实际上无需执行任何操作来执行您的转场,除非您想以编程方式执行此操作,或者单击按钮/单元格/您在情节提要中链接的任何内容。

    编辑:根据this post,您只能在navigationController 内使用push Segue。如果不是这种情况,您可以插入它们并隐藏导航栏,或者创建自定义 Segue。

    【讨论】:

    • 我已经调用了performSegueWithIdentifier,但是如果我没有将presentViewController 放入我的prepareForSegue 方法中,那么什么也不会发生。
    • 你是如何配置你的 Segue 的?
    • 我正在从计时器调用 segue,所以我只能将 segueview controller 链接到下一个 navigation controller
    • 你的 Segue 的风格是什么(在你的故事板中)?我已经完成了从 ViewController 到 ViewController 的转换,我所做的只是调用performSegueWithIdentifier。您的控制器在navigationController 中吗?
    • 我明白了。我已经决定使用模态转场并在过渡中使用淡入淡出。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-09-30
    • 2011-06-16
    • 2016-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-02
    相关资源
    最近更新 更多