我的应用程序在过渡过程中间歇性冻结。在调试模式下设法让它冻结后,我们暂停了它并截取了屏幕截图。一些注意事项:
- 在冻结状态下,CPU 仍在对敲击做出反应,因此它仍在以某种方式响应
- 查看线程,似乎没有无限循环、繁重的功能或其他任何东西。
然而,查看 UI ViewHierarchy 会发现一件有趣的事情 - 有 2 个顶级 UIWindows,最上面的一个完全为空,而按钮一个被转换视图覆盖。
这里可能的罪魁祸首是什么?我的代码包含在屏幕截图下方:
// view controller
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let question = dataAccessor.objectAtIndexPath(indexPath)
delegate?.feedViewControllerDidSelect(self, question: question)
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
// delegate for viewcontroller
func feedViewControllerDidSelect(viewController: FeedViewController, question: Question) {
let questionDetailViewController = QuestionDetailViewController.create(question, delegate: self)
navigationController.pushViewController(questionDetailViewController, animated: true)
}
// Question Detail View
static func create(question: Question, delegate: QuestionDetailViewControllerDelegate?) -> QuestionDetailViewController {
let vc = StoryboardScene.QuestionDetail.instantiateQuestionDetailVC()
vc.question = question
vc.delegate = delegate
return vc
}