Chris
Chris

Reputation: 7310

Objective C: Determining the coordinates of a 'click'

I'm trying to make a UIImageView loaded with an array for an animation appear on top of a button when it is clicked. The location of the buttons is random so I have no way of initializing the UIImageView with a frame. How do I pass in the X and Y coordinates of where the user taps on the screen?

Upvotes: 1

Views: 431

Answers (1)

Jim
Jim

Reputation: 73936

When you hook up the IBAction for the UIButton, it is passed the button object itself when it is called. The UIButton's frame property should give you everything you need.

Also, you don't "click" on iOS, you "tap".

Upvotes: 2

Related Questions