问题
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:
- Deleting button or using a different button
- 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