Search code examples
iphoneuiimageviewtouchipod-touchtap

Making images appear... How?


Could someone please tell me how to make an image appear when the user taps the screen and make it appear at the position of the tap. Thanks in advance, Tate


Solution

  • UIView is a subclass of UIResponder, which has the following methods that might help: -touchesBegan:withEvent:, -touchesEnded:withEvent:, -touchesCancelled:withEvent: and -touchesMoved:withEvent:.

    The first parameter of each of those is an NSSet of UITouch objects. UITouch has a -locationInView: instance method which should yield the position of the tap in your view.