从按钮执行 segue 时应用程序冻结 [英] App freezes when segue performed from button

查看:20
本文介绍了从按钮执行 segue 时应用程序冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的故事板中有一个按钮,用于显示带有模态转场的视图控制器.每次按下此按钮时,应用程序都会冻结(没有崩溃也没有错误消息).prepareForSegue 被调用,所有应该存在的视图控制器都在 prepareForSegue 的代码中,但它们没有出现在屏幕上.我可以从同一个按钮模态切换到另一个视图控制器就好了.关于为什么会发生这种情况或如何解决它的任何想法?

I have a button in my storyboard that presents a view controller with a modal segue. Every time this button is pressed, the app freezes (There is no crash and no error message). prepareForSegue is called and all the view controllers that should be there are there in code in prepareForSegue, but they don't appear onscreen. I can modal segue from the same button to another view controller just fine. Any ideas on why this is happening or how to fix it?

我尝试过的事情:

  1. 删除按钮或使用其他按钮
  2. 在 IB 中重新创建 segue

推荐答案

终于让 Xcode 给我一个错误信息......结果我已经完成了

Finally got Xcode to give me an error message... turns out I had done

if (self == [super init]) {
}

我应该做的时候

if (self = [super init]) {
}

导致各种内存问题.

这篇关于从按钮执行 segue 时应用程序冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆