Reputation: 755
How do I animate the TextField without disabling it?
UIView.animate(withDuration: 1.0, delay: 0.0, options: [.repeat, .autoreverse, .curveEaseInOut], animations: {
(self.phoneCell.subviews[1].subviews[1] as! UITextField).layer.backgroundColor = UIColor.black.withAlphaComponent(0.2).cgColor
}, completion: nil)
Upvotes: 2
Views: 311
Reputation: 154711
To allow user interaction for your UITextField
during animation, you need to add the option .allowUserInteraction
:
UIView.animate(withDuration: 1.0, delay: 0.0,
options: [.repeat, .autoreverse, .curveEaseInOut, .allowUserInteraction],
animations: {
self.myTextField.layer.backgroundColor = UIColor.black.withAlphaComponent(0.2).cgColor
}, completion: nil)
Upvotes: 1