我正在尝试通过 Xcode 7.2.1 中的故事板设置自定义展开转场动画。如果我在文档大纲中选择展开转场,我会看到属性检查器中有一个可用的类选项来提供 UIStoryboardSegue 类。但是,当我在那里设置自定义 Segue 类并运行我的应用程序时,出现以下错误:
Error:
由于未捕获的异常而终止应用程序UIViewControllerHierarchyInconsistency
,原因:子视图控制器:DestinationTableViewController
应该有父视图控制器:SourceTableViewController
:但实际的父级是:UINavigationController: 0x12e8e9400
目标表视图控制器展开转场代码:
@IBAction func unwindToCategoriesTableViewController(segue: UIStoryboardSegue) {
//back to categories view
if segue.sourceViewController is ServiceDetailsTableViewController {
checkmarkLabel.hidden = false
}
自定义segue类:
class CustomShrinkToCenterSegue: UIStoryboardSegue {
override func perform()
{
let sourceVC = self.sourceViewController
let destinationVC = self.destinationViewController
sourceVC.view.addSubview(destinationVC.view)
destinationVC.view.transform = CGAffineTransformMakeScale(1, 1)
UIView.animateWithDuration(0.5, delay: 0.0, options: .CurveEaseInOut, animations: { () -> Void in
destinationVC.view.transform = CGAffineTransformMakeScale(0.05, 0.05)
}) { (finished) -> Void in
destinationVC.view.removeFromSuperview()
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(0.001 * Double(NSEC_PER_SEC)))
dispatch_after(time, dispatch_get_main_queue()) {
sourceVC.presentViewController(destinationVC, animated: false, completion: nil)
}
}
}
}
在文档大纲中选择 segue 时的属性检查器选项
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)