App freezes when segue performed from button

岁酱吖の 提交于 2019-12-23 20:03:11

问题


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?

Things I have tried:

  1. Deleting button or using a different button
  2. Recreating the segue in IB

回答1:


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

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

when I should have done

if (self = [super init]) {
}

which caused all sorts of memory problems.




回答2:


I had a similar issue in iOS 9 that was fixed by not setting any text in UITextViews, in the storyboard, that were in the destination view controller... bizarre but it fixed it!

iOS 9 Segue Causes App To Freeze (no crash or error thrown)



来源:https://stackoverflow.com/questions/19237374/app-freezes-when-segue-performed-from-button

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!