viewWillTransitionToSize

viewWillTransitionToSize

该代码以前可以在我们的今天的扩展程序中使用,现在可以在使用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)
}

最佳答案

有人向我提到,他们认为这是Apple的错误。这是一种解决方法(或解决方案):

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")
    }
}

关于ios - 带有viewWillTransitionToSize和Xcode 6.3的EXC_BAD_ACCESS,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29805843/

10-10 20:36