I’m using a tap gesture recognizer to position a little subview with a label within another UIView. When the user taps on a view, the label is populated with the title of the component that the user tapped on, and the subview is centered at the tap location.
I need to make sure that the initial position of my gesture recognizer matches the center of the subview as defined in the storyboard(before the user taps on a view), but it seems that I’m unable to find a way to pass this point over to the gesture recognizer.
Is there a way to initialize my tap gesture recognizer with a certain point within a view?
I’m not quite sure what you are asking. Gesture Recognizes do not have a “starting point”. They receive various touch types for touches inside of a given view and allow you to uniquely handle each one.
If you want to simulate a touch on loading (which sort of sounds like that might be what you are looking to do), reorganize your code to be something like this:
In this example, you could start the position/data of your subview based on what it would be if there was a touch at 100,100.
Note: I left out code configuring your gesture recognizer because it sounds like you already have that part under control. If not, I can post with more code.