How to flip an individual UIView (without flipping the parent view)

前端 未结 6 517
一整个雨季
一整个雨季 2020-11-27 15:16

This is an iPad project where I have a UIView with several subViews, and I am trying to animate one of this UIViews using [UIView transitionFromView:toView:duration:options:

6条回答
  •  鱼传尺愫
    2020-11-27 15:39

    I'd like to make an update of Steve Parker's answer in SWIFT 4:-

    var displayBlankView:Bool = true
    
    UIView.transition(with:flipView, duration:1.0, options:displayBlankView ? .transitionFlipFromLeft:.transitionFlipFromRight, animations:{
            if(self.displayBlankView){
                self.view1.isHidden=true
                self.view2.isHidden=false
            }else{
                self.view1.isHidden=false
                self.view2.isHidden=true
            }
        }, completion:{
            (finished: Bool) in
            self.displayBlankView = !self.displayBlankView;
    
        })
    

提交回复
热议问题