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 trialShaun Kelly
5,648 PointsCan somebody explain the difference between the view and the viewcontroller ?
?
1 Answer
Stone Preston
42,016 Pointsa view is just what the screen looks like. views just get displayed and thats it.
a view controller is what manages and controls views. it has one main view and that main view has many subviews such as buttons and labels. the view controller controls the view and subviews and can tell them what to display, when to display it etc. it manipulates the view and subviews.
iOS uses whats known as the Model-View-Controller design patter. you can read more about that here.
The view controller acts as an interface between the view (visual display) and the model (the data, logic, and rules thats used in your app such as names to be displayed in a table etc).