简体   繁体   中英

iOS : Programmatically call onTapGesture from another view

I currently have a UIView, call it (A), that is outsourced out into a 3rd party library. Pressing onTapGesture physically would be simple, but the problem here is that this (A) is on another view hierarchy, versus the one I have. The reason for this is that I apply transforms to this separate from (A).

Im deciding on delegating a UIButton that will programmatically call the UIView in question's onTapGesture, is there a way to do this?

I do not have access to this 3rd party library's selector for onTap.

This is a very late answer to your question. If you still working on this may be my answer will be helpful or may be someone else will find it helpful.

The gesture doesn't expose its target and action. In this case may be creating a fake touch programatically will be helpful. As you have UIView you can easily get the window of that view. With window find out the x,y co-ordinate and create a fake UITouch event. I also had similar kind of problem and creating fake touch worked for me. This is the link I referred for creating fake touches.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM