问题
This code used to work in our today extension, but now EXC_BAD_ACCESS with using Xcode 6.3. What is the new problem?
override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
coordinator.animateAlongsideTransition({ context in
self.tableView.frame = CGRectMake(0, 0, size.width, size.height)
}, completion: nil)
}
回答1:
Someone mentioned to me they think this is an Apple bug. Here's a workaround (or the solution):
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")
}
}
来源:https://stackoverflow.com/questions/29805843/exc-bad-access-with-viewwilltransitiontosize-and-xcode-6-3