简体   繁体   中英

Xcode View Controllers

This may be kind of a new noob question, but what are view controllers in Objective-C? How is a UIView different from a UIViewController? Thanks very much!!

There is a design pattern called MVC (Mode, View, Controller) It is the idea that every class you make needs to fit neatly in one and only one of these categories.

Model objects hold data.

View objects are visible to the user, and accept input from the user. (input being a button press, or sliding a finger across the screen)

A Controller is in charge of orchestrating the conversation between the Model and the View.

To be honest, this is a fairly basic concept. If its something with which you are unfamiliar i would recommend checking out some other resources. You will be much happier with your programming experience if you have a solid understanding of these basic principals.

http://www.bignerdranch.com/book/ios_programming_the_big_nerd_ranch_guide_rd_edition_ is an excellent book.

A view controller a kind of middle man between what is displayed and the data model backing your application.

Here is a full description .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM