在淡出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()
}
})