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


Has anyone used constraints programmatically

I'm doing the crystal ball extra credit, and have got the button to appear on the 4.0 screen, but not the 3.5 inch screen. Has anyone used constraints programmatically? I've been looking at some documentation, but It's a little confusing. If anyone could help that would be great!!! Amit Bijlani

1 Answer

Hello tristan,

May i simply say auto layout programmatically really freakin sucks, I made a project with it and you have to really think about what might i be missing and xCode won't tell what you're missing and you app will crash if you're missing constraints. You probably have seen something like this if you've been googling a while,


this is the string constraints and, because it's a string, has no auto complete making it quite typo prone and can crash really easily if done wrong. auto layout is one of those thing that make me want to switch to interface builder so my life will be easier but I simple do it in code.

anyways, if you've googled it you'll know it's kind of a pain, but it is unfortunately one of those things that is just like that.

sorry for the bad news, Kai