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 Differing Height Views: Code

Cory Cromer
Cory Cromer
5,171 Points

Is there an error in the video?

When setting the anchor for the bottom of the redView within the brackets of the else clause, shouldn’t the bottom anchor of the redView be aligned to the TOP ANCHOR of the bottomLayoutGuide (Line 45)?

Ex: redView.bottomAnchor.constraint(equalTo: bottomLayoutGuide.topAnchor, constant: -8.0)

In the video, Mr. Premaratne aligned the bottom anchor of the redView to the bottom anchor of the bottomLayoutGuide.

1 Answer

Clark Reilly
Clark Reilly
6,204 Points

Seems so. Well spotted, although this is likely pointless since nobody runs iOS 10 or lower anymore.