Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macman7002

macrumors regular
Original poster
Apr 28, 2008
100
0
Hello there, sorry if this question has already been asked and answered. I tried a Google search but couldn't find anything on what I am trying to do for my skill level. I am new to iPhone developing and relatively new to Mac developing. But what I am looking to do is make a UIImageView change the the displayed image whenever a user taps the UIImageView. Does anyone know of any articles online about doing something like this? Or could anyone give me advice about how to do this?
Thank you!!
 

drf1229

macrumors regular
Jun 22, 2009
237
0
Ok, I think the best thing to do is to tell you what you need to do, not specifically the code that does it. First, you need to use TouchesBegan to capture the touch event. In that method, you need to change the UIImageView's image property to change the image. If you want the image to go in a sequence, you should create an integer to represent which image the ImageView will change to. Then, use a switch loop in your touchesBegan method to switch the image accordingly.
 

macman7002

macrumors regular
Original poster
Apr 28, 2008
100
0
Thank you drf1229!! I think this is the reading material I need! I really appreciate your help!
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
You might want to consider using a UIButton with an image for a background view instead. Buttons are already designed to respond to taps and trigger methods.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.