DynamicButton
DynamicButton copied to clipboard
Animation not working if button is added on Interface Builder
I added a button on interface builder. Set up click event. When changing the style, the animation is not working. The style does change, but without animation
the problem was not adding the button from interface builder, but changing the style from the click event. Somehow, it doesn't work
That helps:
@IBAction func buttonPressed(_ sender: Any) {
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100), execute: {
self.dynamicBtn.setStyle(.caretUp, animated: true)
})
}