animating button Allowuserinteraction not working

后端 未结 2 860
独厮守ぢ
独厮守ぢ 2021-01-18 01:01

I have a UIbutton created in code in an NSObject class which controls a game in a UIViewController class. The button works fine throughout most of the game, but at a certain

相关标签:
2条回答
  • 2021-01-18 01:19

    Swift 3 Xcode 8:

    AllowUserAction is now deprecated to allowUserAction.... go figure

    func nextButtonWink() {
    UIView.animateWithDuration(1.5, delay: 0, options: [.allowUserInteraction,
        animations: { 
    
    0 讨论(0)
  • 2021-01-18 01:32

    Take out self.nextButton.alpha = 0 to test this out, I believe that button events will not fire when alpha is zero. When it comes to animations, the actual object's alpha will get set to zero before the animation starts, and what you are seeing is like a rendered interactive screenshot of your view as it animates

    If that is the case, then you need to set the alpha to something like 0.0100000003 or override the button to be interactive at alpha 0

    0 讨论(0)
提交回复
热议问题