Reputation: 389
I can't set the 'enabled' property with gesture recognizers. I tried creating recognizers both programmatically and by adding an @IBAction
in Xcode
and connecting it by control drag to the code.
I try to use properties like this:
swipeUpOccurred(swipeUp: UISwipeGestureRecognizer).enabled = false
But it is showing error:
Value of type '(UISwipeGestureRecognizer) ->' does not have member 'enabled'
Upvotes: 1
Views: 878
Reputation: 72410
You are trying to set the isEnabled
on the action of UIGestureRecognizer
. Instead of that you need to create the Outlet of UIGestureRecognizer
if you want to access it inside your ViewController
, so create one Outlet of that gesture with its specific type then set isEnabled
property to true/false
when ever you need to enable/disabled
it.
@IBOutlet var swipeGest: UISwipeGestureRecognizer!
Now use isEnabled
property with it.
self.swipeGest.isEnabled = false
Upvotes: 5
Reputation: 17364
It was renamed. Try isEnabled
instead.
swipeUpOccurred(swipeUp: UISwipeGestureRecognizer).isEnabled = false
Upvotes: 0