2

Using "@IBOutlet var checkAvalibilityBtn: UIButton!", created a blinking code and called in viewdidLoad

   `override func viewDidLoad() {
    super.viewDidLoad()

    self.checkAvalibilityBtn.alpha = 1.0
    UIView.animate(withDuration: 0.80, delay: 0.0, options: [.curveEaseIn, .repeat, .autoreverse, .allowUserInteraction], animations: {() -> Void in
        self.checkAvalibilityBtn.alpha = 0.0
    }, completion: {(finished: Bool) -> Void in
    })`

But the buttion Action is not Working

@IBAction func checkBAvaBtnClick(_ sender: UIButton) { print("Success") }

SCS
  • 435
  • 3
  • 12

1 Answers1

3

view alpha 0 does not receive touch events from the system, Refer SO old answer

override func viewDidLoad() {
    super.viewDidLoad()

    self.checkAvalibilityBtn.alpha = 0.0
    UIView.animate(withDuration: 0.80, delay: 0.0, options: [.curveEaseIn, .repeat, .autoreverse, .allowUserInteraction], animations: {() -> Void in
        self.checkAvalibilityBtn.alpha = 1.0
    }, completion: {(finished: Bool) -> Void in
    })
Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143