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 Build a Simple iPhone App with Swift View Controllers and Views Recap: Views

James Rimmer
James Rimmer
2,603 Points

"Each iPhone app has one window which acts as a container for the views in our app"

I put 'False' for this question and it said I was incorrect, but actually it is a poorly worded question. Each iPhone app doesn't necessarily have one window, as the video lesson stated that each iPhone app has AT LEAST one window (the implication being there could be multiple windows within the app). Will this question be updated?

1 Answer

Nathan F.
Nathan F.
30,773 Points

This is a little tricky one--I'd have to go back to see where the video says "at least" one window to confirm, but the answer is indeed actually "true." If you open a recent iOS project, or even a new one, and use the "Debug View Hierarchy" button, You'll see that underneath your multiple views is a single object called "UIWindow".

It is possible to have more than one UIWindow, but as the docs specify, this is typically for displaying content on an external monitor or something of that sort.

The phrasing might be a bit confusing, but it's still true--there's always one UIWindow object which manages and contains our views.

James Rimmer
James Rimmer
2,603 Points

Thanks Nathan for coming back on this one. If, as you state, there is the possibility of having more than one window (albeit in rare cases), and if the statement in the question is specifically worded "Each iPhone app HAS one window..." rather than "...AT LEAST one window", then surely the fact that it is possible to have MORE THAN one means the statement "Each iPhone app HAS one window..." is in fact 'False' as it is actually possible to have MORE THAN one window? Would you agree?