我使用transitionFromView
切换两个UIView,但是它有一些错误,当我将视图转换到第二个UIView时,它工作正常,然后我转换视图返回错误发生(第一个位置UIView错了)
会发生什么?
self.primaryView.hidden = !self.primaryView.hidden self.secondaryView.hidden = !self.secondaryView.hidden println("\(self.primaryView)") UIView.transitionFromView(displayingPrimary ? self.primaryView : self.secondaryView, toView: displayingPrimary ? self.secondaryView : self.primaryView, duration: 1.0, options: nil ) { (finish) -> Void in if finish { println("after:\(self.primaryView)") self.displayingPrimary = !self.displayingPrimary; } }
这是控制台中的打印信息
<UIView: 0x79fe3c80; frame = (0 0; 399 349); hidden = YES; autoresize = RM+BM; layer = <CALayer: 0x79fe3d10>>
after:<UIView: 0x79fe3c80; frame = (0 0; 399 349); hidden = YES; autoresize = RM+BM; layer = <CALayer: 0x79fe3d10>>
<UIView: 0x79fe3c80; frame = (0 0; 399 349); autoresize = RM+BM; layer = <CALayer: 0x79fe3d10>>
after:<UIView: 0x79fe3c80; frame = (-436 -328; 399 349); autoresize = RM+BM; layer = <CALayer: 0x79fe3d10>>