【问题标题】:iOS8 performSegueWithIdentifier run too slowiOS8 performSegueWithIdentifier 运行太慢
【发布时间】:2015-01-21 15:23:35
【问题描述】:

这只发生在 iOS8 中。

如果我在按钮单击处理程序中运行“performSegueWithIdentifier”。例如。

- (IBAction)buttonPressed:(id)sender {
    [self performSegueWithIdentifier:@"SegueFromMenuToList" sender:self];
}

然后它就可以正常工作了。

但是如果我显示一个警报视图。然后在alerview委托处理程序中,调用“performSegueWithIdentifier”,加载需要4秒!

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    [self performSegueWithIdentifier:@"SegueFromMenuToList" sender:self];
}

这仅在我第一次调用“performSegueWithIdentifier”时发生,并且仅在 iOS 8 下发生。

任何帮助将不胜感激。谢谢!

更新

尝试在 UI 线程中运行并不能解决问题。

  1. 如果只是第一次滞后,有什么办法可以预加载吗?
  2. 为什么这只发生在 iOS 8 上?

【问题讨论】:

    标签: iphone performance ios8 segue uistoryboardsegue


    【解决方案1】:

    UIAlertView 在 iOS8 中已弃用。开始使用 UIAlertController。
    它在 iOS8 中运行缓慢,因为它必须执行 2 个任务。一种是去掉alert view,另一种是显示segue。有时可能会崩溃(我遇到过)

    【讨论】:

    • 感谢您的回答。我尝试了 UIAlertController,但它仍然滞后约 3-4 秒。奇怪的是,这只发生在 iOS 8 中,而在 iOS7 中,它几乎立即加载。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-04
    • 2017-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-24
    • 2017-01-28
    相关资源
    最近更新 更多