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!

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 (iOS7) Getting Started What Is an IBOutlet?

Shaun Kelly
Shaun Kelly
5,648 Points

Can somebody explain the difference between the view and the viewcontroller ?


1 Answer

Stone Preston
Stone Preston
42,016 Points

a 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).