(CGRect rect) 里面填写的是一个固定视图的frame。 view.frame。 在xcode中需要位置输入。CGRectGetMaxY(CGRect rect)。 这个我经常用
/* Return the leftmost x-value of `rect'. */ 获取视图的最左边部x。
CG_EXTERN CGFloat CGRectGetMinX(CGRect rect)
CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
/* Return the midpoint x-value of `rect'. */ 获取视图的x中间值。
CG_EXTERN CGFloat CGRectGetMidX(CGRect rect)
CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
/* Return the rightmost x-value of `rect'. */。 获取视图的最右边x。
CG_EXTERN CGFloat CGRectGetMaxX(CGRect rect)
CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
/* Return the bottommost y-value of `rect'. */ 下面类似
CG_EXTERN CGFloat CGRectGetMinY(CGRect rect)
CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
/* Return the midpoint y-value of `rect'. */
CG_EXTERN CGFloat CGRectGetMidY(CGRect rect)
CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
/* Return the topmost y-value of `rect'. */
CG_EXTERN CGFloat CGRectGetMaxY(CGRect rect)
CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
/* Return the width of `rect'. */
CG_EXTERN CGFloat CGRectGetWidth(CGRect rect)
CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
/* Return the height of `rect'. */
CG_EXTERN CGFloat CGRectGetHeight(CGRect rect)
CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
本文详细介绍了UIKit中CGRect的相关函数,包括如何获取视图的边界坐标、中心坐标及尺寸等。这些函数对于iOS应用开发中精确控制视图的位置与大小至关重要。
66

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



