EXC_BAD_ACCESS with viewWillTransitionToSize和Xcode 6.3
此代码用于在我们今天的扩展,但现在使用Xcode 6.3的EXC_BAD_ACCESS。 什么是新问题?
override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) { coordinator.animateAlongsideTransition({ context in self.tableView.frame = CGRectMake(0, 0, size.width, size.height) }, completion: nil) }
有人向我提到,他们认为这是一个苹果的错误。 这是一个解决方法(或解决scheme):
override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) { super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator) if let safeCoordinator = coordinator as UIViewControllerTransitionCoordinator? { println("coordinator != nil") safeCoordinator.animateAlongsideTransition({ context in self.tableView.frame = CGRectMake(0, 0, size.width, size.height) }, completion: nil) } else { println("coordinator == nil") } }