CGRect大招

CGRect大招_第1张图片
005VZHNIgy70T4UEqo5bd.png
CGRect frame = CGRectMake(20, 20, 200, 200);
UIView *bigView = [[UIView alloc]initWithFrame:frame];
[self.view addSubview:bigView];
bigView.backgroundColor = [UIColor orangeColor];

1.最小X值(frame.origin.x)
CGRectGetMinX(frame)
2.最小Y值(frame.origin.y)
CGRectGetMinY(frame)
3.中间X值(_bigView.center.x)
CGRectGetMidX(frame)
4.中间Y值(_bigView.center.y)
CGRectGetMidY(frame)
5.最大X值(frame.origin.x+frame.size.width)
CGRectGetMaxX(frame)
6.最大Y值(frame.origin.y+frame.size.height)
CGRectGetMaxY(frame)
7.宽度(frame.size.width)
CGRectGetWidth(frame)
8.高度(frame.size.height)
CGRectGetHeight(frame)

你可能感兴趣的:(CGRect大招)