I have printed a UITableviewCell's gesture in – tableView:didSelectRowAtIndexPath method in NSLog as
<UIScrollViewPanGestureRecognizer: 0x11e92080; state = Possible; cancelsTouchesInView = NO; delaysTouchesEnded = NO; view = <UITableViewCellScrollView 0x11e94bf0>; target= <(action=handlePan:, target=<UITableViewCellScrollView 0x11e94bf0>)>>
and I have assigned this UIScrollViewPanGestureRecognizer to a UIGestureRecognizer to access the properties of it as follows,
UIGestureRecognizer *myGes=[temp.gestureRecognizers objectAtIndex:1];
I'm able to access all properties of 'myGes' as
myGes.state;
myGes.cancelsTouchesInView;
myGes.delaysTouchesEnded;
myGes.view;
Except one property named as target.
Is there any possibility to access that property? because i need to perform that action.
Any comments or suggestions would be appreciated.
Thank you in advance.
There is a way to gain access to the property target
, but I'm not sure that this method will pass the Apple approval process.
NSMutableArray *targets = [myGes valueForKeyPath:@"_targets"];
id targetContainer = targets[0];//get first target for example
id targetOfMyGes = [targetContainer valueForKeyPath:@"_target"];
NSLog(@"%@", targetOfMyGes );//you can see reference for target object
Thanks neilco - his answer help create solution.
Note: the exact class of the object targetOfMyGes
need to define yourself. By default it id
- suitable for any object class.
UIGestureRecognizer
internally maintains an array of targets. There is no public access to this array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With