坐标Geometry,坐标系Coordinate system
其实这部分只是,也是属于:
Cocoa中的坐标系Coordinate system的知识
参考:
有:
即:
iOS中的坐标系:左上角是坐标原点(0, 0),然后水平向右是x值增加,垂直向下是y值增加
Mac中的坐标系:左下角是坐标原点(0, 0),然后水平向右是x值增加,垂直向上是y值增加
[frame,bounds,center]
You Probably Don’t Understand frames and bounds – Ash Furrow
View视图中的常见值的含义
Among the properties you can animate on a UIView object are the following:
- 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.
frame
该view在父view坐标系统中的位置和大小。(参照点是,父亲的坐标系统)
bounds
该view在本地坐标系统中的位置和大小。(参照点是,本地坐标系统,就相当于ViewB自己的坐标系统,以0,0点为起点)
center
该view的中心点在父view坐标系统中的位置和大小。(参照点是,父亲的坐标系统)
画矩形的视图
有三种方式:
- UIKit
- Core Graphics
- OpenGL ES
参考资料
深入探究frame和bounds的区别以及setbounds使用 – CocoaChina_让移动开发更简单
ios view的frame和bounds之区别(位置和大小) – 其实并不难,是你太悲观 – 博客频道 – CSDN.NET
View Controller Programming Guide for iOS: Defining Your Subclass
frame – UIView Class Reference
About Drawing and Printing in iOS
View Controller Programming Guide for iOS: The Role of View Controllers
转载请注明:在路上 » 【整理】iOS中的UIView的基础知识