【iOS开发】iOS开发CGRectGetMidX. CGRectGetMidY.CGRectGetMinY. CGRectGetMaxY. CGRectGetMinX. CGRectGetMaxX的使用


UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 110, 150)]; label.backgroundColor = [UIColor orangeColor]; [self.view addSubview:label]; /* CGRectGetHeight返回label本身的高度 CGRectGetMinY返回label顶部的坐标 CGRectGetMaxY 返回label底部的坐标 CGRectGetMinX 返回label左边缘的坐标 CGRectGetMaxX 返回label右边缘的坐标 CGRectGetMidX表示得到一个frame中心点的X坐标 CGRectGetMidY表示得到一个frame中心点的Y坐标 */ NSLog(@"CGRectGetHeight--%f", CGRectGetHeight(label.frame)); NSLog(@"CGRectGetMaxX--%f", CGRectGetMaxX(label.frame)); NSLog(@"CGRectGetMaxY--%f", CGRectGetMaxY(label.frame)); NSLog(@"CGRectGetMidX--%f", CGRectGetMidX(label.frame)); NSLog(@"CGRectGetMidY--%f", CGRectGetMidY(label.frame)); NSLog(@"CGRectGetMinX--%f", CGRectGetMinX(label.frame)); NSLog(@"CGRectGetMinY--%f", CGRectGetMinY(label.frame)); 2015-04-24 15:39:15.577 webView[15743:677046] CGRectGetHeight--150.000000 2015-04-24 15:39:15.577 webView[15743:677046] CGRectGetMaxX--120.000000 2015-04-24 15:39:15.577 webView[15743:677046] CGRectGetMaxY--160.000000 2015-04-24 15:39:15.577 webView[15743:677046] CGRectGetMidX--65.000000 2015-04-24 15:39:15.578 webView[15743:677046] CGRectGetMidY--85.000000 2015-04-24 15:39:15.578 webView[15743:677046] CGRectGetMinX--10.000000 2015-04-24 15:39:15.578 webView[15743:677046] CGRectGetMinY--10.000000
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
 

 

posted @ 2016-08-24 16:09  paranoia1  阅读(2134)  评论(0编辑  收藏  举报