0

While fading out UIButton, the user is not able to interact with it.

Below is the code which I used in the function 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

2
  • What is the desired behaviour ? I'm not even able to see a question here. Apr 13, 2017 at 20:01
  • I agree with Francis. If you want it so the button deactivates when you press it then set the enabled state to false inside your UIView.Animate closure. Just use: myButtonVaarName.isEnabled = false
    – CardDeath
    Apr 16, 2017 at 23:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.