Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Build an Interactive Story App with Swift Creating the User Interface Programmatically Continuing Our Story

Justin Furstoss
Justin Furstoss
5,166 Points

UIButton choice only coming up as "Play Again"

Why is it that my button choice after clicking "Start Your Adventure" is only presenting me the option to "Play Again" and not the "Stop and Investigate" and "Continue home to Earth" buttons it should be?

https://gist.github.com/JustinFurstoss/341476e0c72e4e9e17a5a359ace9d409

1 Answer

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

The issue is lines 6-7 and lines 41-46. You'll notice that if there is no first choice available, it will create a button that says 'Play Again'. In the first snippet I link to, you are creating the page and returning it. You never add any options for the next page, so you get the default button.

Hope that makes sense and you can sort it out!

By the way, I love how you put all the code in a Gist. Made it really easy for me ?