动画

时间:2017-04-13 17:48:46

标签: swift uiview swift3 uibutton uianimation

在淡出UIButton时,用户无法与其进行交互。

以下是我在函数viewdidload中使用的代码。

    /******************** Image fade ***********************/

    self.imgaefade1.isHidden = false
    UIView.animate(withDuration: 2, delay:0.5, options:UIViewAnimationOptions.transitionFlipFromTop, animations: {
        self.imgaefade1.alpha = 0
    }, completion: { finished in
        self.imgaefade1.isHidden = true
    })

   /**********************/
    self.menuBtn.isHidden = false

    // UIView.animate(withDuration: TimeInterval(2), delay: 0.5,
    UIView.animate(withDuration: 2, delay:0.5, options:UIViewAnimationOptions.transitionFlipFromTop, animations: {
        options: UIViewAnimationOptions.allowUserInteraction, animations:  {
        self.menuBtn.alpha = 0
    }, completion: { finished in

        if (self.menubool) {
            self.menuBtn.isHidden = true
            // self.menuBtn.removeFromSuperview()
        }
    })

enter image description here

0 个答案:

没有答案