1. Windows do not have any visible content themselves but provide a basic container for your application’s views.
2.Views are responsible for drawing content, handling multitouch events, and managing the layout of any subviews. Drawing involves using graphics technologies such as Core Graphics, OpenGL ES.
3. In the view hierarchy, parent views are responsible for positioning and sizing their child views and can do so dynamically.
4. If an external display is connected to the device, applications can create a second window to present content on that screen as well.
5. UIView's designated initializer is initWithFrame:
6. Also, you can hide a view completely by setting hidden property @property (nonatomic) BOOL hidden;
myView.hidden = YES;
View and Window Architecture
1. Views work in conjunction with Core Animation layers to handle the rendering and animating of a view’s content. Every view in UIKit is backed by a layer object (usually an instance of the CALayer class), which manages the backing store for the view and handles view-related animations.

2. Every view has a corresponding layer object that can be accessed from that view’s layer property. Behind those layer objects are Core Animation rendering objects and ultimately the hardware buffers used to manage the actual
bits on the screen.
3. The actual drawing code of a view object is called as little as possible, and when the code is called, the results are cached by Core Animation and reused as much as possible later.
View Hierarchies and Subview Management
The View Drawing Cycle
Content Modes
1. Each view has a content mode that controls how the view recycles its content in response to changes in the view’s geometry and whether it recycles its content at all.
2. The content mode of a view is applied whenever you do the following:
(1)Change the width or height of the view’s frame or bounds rectangles.
(2)Assign a transform that includes a scaling factor to the view’s transform property.
3.By default, the contentMode property for most views is set to UIViewContentModeScaleToFill


4. 视图几何大小的改变不会引起系统调用drawRect方法
Stretchable Views
1.You can designate a portion of a view as stretchable so that when the size of the view changes only the content in the stretchable portion is affected.
2.You specify the stretchable area of a view using the contentStretch property. This property accepts a rectangle whose values are normalized to the range 0.0 to 1.0.
3.
Built-In Animation Support
frame—Use this to animate position and size changes for the view.
bounds—Use this to animate changes to the size of the view.
center—Use this to animate the position of the view.
transform—Use this to rotate or scale the view.
alpha—Use this to change the transparency of the view.
backgroundColor—Use this to change the background color of the view.
contentStretch—Use this to change how the view’s contents stretch.
View Geometry and Coordinate Systems

The Relationship of the Frame, Bounds, and Center Properties
---The frame property contains the frame rectangle, which specifies the size and location of the view in its superview’s coordinate system.
---The bounds property contains the bounds rectangle, which specifies the size of the view (and its content origin) in the view’s own local coordinate system.
---The center property contains the known center point of the view in the superview’s coordinate system.

本文介绍了iOS中视图(View)与窗口(Window)的基本概念及其工作原理,包括视图的绘制周期、内容模式、拉伸视图、内置动画支持等内容,并详细解释了视图几何与坐标系统的相关知识点。
4644

被折叠的 条评论
为什么被折叠?



