• 【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
     
  • 相关阅读:
    day21继承
    day22
    面向对象
    常用模块
    模块
    迭代器
    【游记】2020-CSP
    【初赛解析】2021CSP-S初赛解析(不完全)
    【题解】AcWing 1390.通电围栏
    【题解】AcWing 1387.家的范围
  • 原文地址:https://www.cnblogs.com/paranoia/p/5803383.html
Copyright © 2020-2023  润新知