Instead of:
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc]
initWithTarget:_cameraUI.view
action:@selector(toggleControlsWithGesture)];
do:
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc]
initWithTarget:self
action:@selector(toggleControlsWithGesture)];
Explanation:
For your UISwipeGestureRecognizer
object, you are currently doing -initWithTarget:_cameraUI.view
.
This means the target that will respond to the specified action method will be _cameraUI.view
but _cameraUI.view
does not provide any -toggleControlsWithGesture
method and hence the error.
The -toggleControlsWithGesture
method will be found in this class and so you will need to specify the target as self
.
Example: Consider in XYZClass.m, we do something like:
ABCClass *abcObject = [ABCClass alloc] init];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:abcObject
action:@selector(doSomething)];
This basically says that the abcObject
will respond to the event by firing a doSomething
method.
But... for this to happen, ABCClass
should have defined the doSomething
method.
In your case, _cameraUI
is of UIImagePickerController
class and it's view
may be a property or another class object. In either case, it does not have the -toggleControlsWithGesture
method which you created for your purposes.