Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-21-2010, 01:05 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 120
Default How to Show image when tapped?

How would you show an image where the user tapped the screen? Using the TouchesEnded or TouchesBegan? When the user taps the middle of the screen an image will pop up where it touched.

Any help on this would be great!
CAmaninacan is offline   Reply With Quote
Old 03-21-2010, 02:11 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,886
Default

You can get the touch location in touchesBegan, then it's just a simple matter of adding a UIImageView subview and setting it's center to the touch location.
harrytheshark is offline   Reply With Quote
Old 03-21-2010, 04:04 PM   #3 (permalink)
Dr. Touch Cocoa Helpdesk
iPhone Dev SDK Supporter
 
Join Date: Sep 2008
Location: Vienna, Austria
Posts: 537
Send a message via AIM to Oliver Drobnik Send a message via MSN to Oliver Drobnik Send a message via Skype™ to Oliver Drobnik
Default

Quote:
Originally Posted by CAmaninacan View Post
How would you show an image where the user tapped the screen? Using the TouchesEnded or TouchesBegan? When the user taps the middle of the screen an image will pop up where it touched.

Any help on this would be great!
You could make the whole screen a UIButton and depending on what kind of touch you are looking for (usually touch up inside) you can have the touch event also be passed to it:

Code:
- (void) tapped:(id)sender withEvent:(UIEvent *)event
from the event object you can get the touched coordinates, locationInView is your friend.
__________________
regards

Oliver Drobnik
Cocoanetics - Our DNA is programmed in Objective-C.

Linguan – makes localizing strings file fun!

Cocoanetics Parts Store – easy to use yet professionally looking components that you can use to spruce up your own apps. Augmented Reality, Calendar Control, Pin Lock or Purchase Button are only some examples. You get full source code, no static library crap, and lifetime support. Check it out today!
Oliver Drobnik is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 251
16 members and 235 guests
@sandris, ADY, Alsahir, cacao, dacapo, Dani77, Desert Diva, djohnson, HemiMG, jansan, M@realobjects, MarkC, prchn4christ, smethorst, tomtom100
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,762
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:56 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0