Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Matthew Randall
218 PointsUIButtons that swap images
Hello, I'm trying to use a UIButton that switches an image onclick. I understand you can create a custom UIButton and change the background or create a "toggle" type switch. Unfortunately, for my app I need to have the button to be separate from the image (when clicked it changes between two images on a different part of the screen). I have found a tutorial on this before but now am having trouble locating it. Any help is much appreciated. I am brand new to treehouse and Objective-C btw ;)
3 Answers
Matthew Mascioni
20,444 PointsMatthew,
I created a sample project with basic functionality to switch between images-- code available here :) I've documented certain things that'll hopefully help you along the way.
Have fun building your app!
Matthew Mascioni
20,444 PointsHey Matthew,
Welcome to Treehouse! (and learning like, the coolest language ever)
Do you think you could clarify more of what you mean? Would you like to have an image and then a button somewhere (maybe below it?) that would change the image when tapped?
Matthew Randall
218 PointsYes, exactly. An image with a button below it that changes the image when tapped. Also, when the button is pressed a second time, I would like the image to revert back to the original.
Thanks Matthew!