本文介绍了View和View Controller之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

屏幕。它也可能包含其中的其他视图(子视图),并随其移动。视图可以获得触摸事件并更改其视觉状态。视图是愚蠢的,不知道你的应用程序的结构,只是被告知要在某种状态下显示自己。



视图控制器不能直接绘制到屏幕,它管理一组视图对象。视图控制器通常对多个子视图有一个视图。视图控制器管理这些视图的状态。视图控制器是智能的,并且知道你的应用程序的内部工作。它告诉哑视图对象要做什么以及如何显示自己。



视图控制器是整个应用程序和屏幕之间的粘合剂。根据应用程序的逻辑控制它拥有的视图。


from an iphone development perspective

解决方案

A view is an object that is drawn to the screen. It may also contain other views (subviews) that are inside it and move with it. Views can get touch events and change their visual state in response. Views are dumb, and do not know about the structure of your application, and are simply told to display themselves in some state.

A view controller is not drawable to the screen directly, it manages a group of view objects. View controllers usually have a single view with many subviews. The view controller manages the state of these views. A view controller is smart, and has knowledge of your application's inner workings. It tells the dumb view objects what to do and how to show themselves.

A view controller is the glue between your overall application and the screen. It controls the views that it owns according to the logic of your application.

这篇关于View和View Controller之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 12:46