How to detect tap on small nearest buttons in iOS?

2019-05-21 10:54发布

问题:

I need to build an app in which there is an image. On image there are many points where user can tap and depend upon that location of tap we need to take input. Tap locations are fixed.

User can zoom image. Detect multiple taps. (Single tap, double tap, etc.)

Biggest problem we are facing is there are too many points near to each other. So if we tap on one point we are getting other points clicked.

Following is the image according which I need to work on.

I need to detect tap on all red dots and take decision based upon that. That red dots will not be visible to user.

What I have tried is following.

Placed buttons on image as shown image. But problem is when user tap on button either button's tap event is not calling or it's not tapping right button which user seems to tap.

What I am thinking to do now is.

Taken image in scroll view then detect tap of scroll view and then based upon co-ordinates detect tap.

Is there any easier way to detect tap?

回答1:

Your requirement is a pretty complex one.

Here you have to take a help of Core image. You need to process that image and get the core details of that image. Also "Morphological Operations" will help you to detect object from image. Take a look on links:

Core image processing

Morphological Operations