1.frame 是结构体包含
struct CGRect {
CGPoint origin;
CGSize size;
};
typedef struct CGRect CGRect;
CGRect originFrame = self.iconBtn.frame;可以获取到origin.x 和 origin.y ,可以改变一个视图的位置,也可以改变一个视图的大小, 获取视图的大小可以这样获取 CGRect originFrame = self.iconBtn.frame; originSize.size.width(视图的宽度) originSize.size.height(视图的高度)
2.CGpoint 结构体
struct CGPoint {
CGFloat x;
CGFloat y;
};
typedef struct CGPoint CGPoint;
通过CGPoint这个属性也可以改变一个视图的位置 CGPoint originPoint = self.view.center; 这样就可以获得originPoint.x,originPoint.y 。通过改变x,y的值就可以改变视图的位置。
3.bounds是以坐标系统为起始点的 (0,0,width, height);也是一个结构体
struct CGRect {
CGPoint origin;
CGSize size;
};
typedef struct CGRect CGRect; CGRect originSize = self.iconBtn.bounds; 这样可以获取一个视图的bounds,通过bounds也是可改变视图的大小。