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

iOS

TechDegree: Could I get some advice on how to "display a mix of 3 and 4 choice questions, while re-spacing UI elements"?

I've put together an if statement that correctly detects when there is only 3 choices to the question.

And I'm trying to make it so that the button that has no question gets resized to "0", so that the other buttons then get moved to the correct places instead of just making the button hidden. (to meet the requirements: "spaced or resized appropriately, not simply hidden.")

But from everything I've tried, I'm finding that I can't change the button dimensions programmatically if the buttons have been created via the autolayout/Interface builder. If I disable the "Use Auto Layout" in the file inspector, then I'm able to modify the button dimensions programmatically.

So I understand that if the UI View is created programmatically then I can make changes.

But since we haven't covered how to create the whole interface programmatically in the lessons, I've sure there has to be a simpler and better way to do this. Maybe it needs a completely different approach than what I'm trying.

Any suggestions/advice to get me in the right direction is VERY appreciated!!!

Thanks in advance.

This is for the TechDegree Project 2: Enhancing a Quiz App in iOS

Hi Alex, thanks for reaching out. The best place to ask questions regarding the course and the project will be on our Slack community. I see that you created an account on Slack already. I'll re-post it on the Project 2 channel for you. Please watch for the discussion. Thanks.

1 Answer

Great! Thanks for your help.