【发布时间】:2017-11-16 10:07:49
【问题描述】:
我正在尝试向具有 xib 的 UIViewController 添加自定义转换。我尝试了几种方法,但它们都有相同的问题,视图显示错误的屏幕尺寸。
我当前的示例基于以下教程:Custom UIViewController transition in iOS with Swift
我没有对 TransitionDelegate 或 Animators 进行任何更改。
这是 xib 和模拟器中的视图:
白色 UIView 设置为居中,宽度为 80%,比例为 1:1。
我的 UIViewController 使用以下内容加载:
let thirdViewController = ThirdViewController()
thirdViewController.transitioningDelegate = viewTransitionDelegate
thirdViewController.modalPresentationStyle = .custom
navigationController?.present(thirdViewController, animated: true, completion: nil)
如果我注释掉设置委托,视图将 100% 完美加载:
最后,我有另一个 UIViewController 没有 xib 并且约束是通过编程设置的。这个视图加载了相同的过渡并且完美加载:
我需要进行哪些更改才能使其与 XIB 一起使用?
【问题讨论】:
标签: ios uiviewcontroller xib uiviewanimationtransition