lxian2
2016-01-20 11:45:03 +08:00
我认为原因是 dismiss 的时候 animateTransition 里面没有设置 transitionContext.containerView()
改成
```
if let toVC = toVC, toView = toVC.view, fromVC = fromVC, fromView = fromVC.view {
if isPresenting {
var frame = transitionContext.initialFrameForViewController(fromVC)
frame.origin.y = frame.size.height
toView.frame = frame
transitionContext.containerView()?.addSubview(toView)
} else {
toView.frame = transitionContext.finalFrameForViewController(toVC)
fromView.frame = transitionContext.initialFrameForViewController(fromVC)
print(toView.frame, fromView.frame)
transitionContext.containerView()?.addSubview(toView)
transitionContext.containerView()?.addSubview(fromView)
toView.alpha = 0.5
toView.transform = CGAffineTransformMakeScale(0.98, 0.98)
}
}
```
就可以看到你想要的效果了