zoukankan      html  css  js  c++  java
  • CGRectInset CGRectoffset UIEdgeInsetsInsetRect 这三个函数的使用情况

    //CGRectInset  将原来的矩形放大或者缩小,正表示缩小,-表示放大。
    CGRect rect= CGRectMake(20, 50, 100, 80);
     CGRect rect1=CGRectInset(rect, -10, 20);
     NSLog(@"%@",p(rect1));
    //输出结果:2014-11-22 18:48:55.351 TestCGRectInset[8893:60b] {{10, 70}, {120, 40}}
    //CGRectOffset 这个函数就是将原来矩形的坐标点变化一下,就是左上角点
    CGRect rect= CGRectMake(20, 50, 100, 80);
    CGRect rect1=CGRectOffset(rect, -10, 20);
    NSLog(@"%@",p(rect1));
    //输出结果:2014-11-22 18:51:58.217 TestCGRectInset[8913:60b] {{10, 70}, {100, 80}}
     //UIEdgeInsetsInsetRect 表示在原来的rect基础上根据边缘距离内切一个rect出来
    CGRect rect= CGRectMake(20, 50, 100, 80);
    UIEdgeInsets ed=UIEdgeInsetsMake(-3, -4, -5, -6);
    CGRect  r=  UIEdgeInsetsInsetRect(rect, ed);
    NSLog(@"%@",p(r));
    //输出结果:2014-11-22 18:54:31.979 TestCGRectInset[8922:60b] {{16, 47}, {110, 88}}

    综上总结:正的都是向内的方向,反之负的就表示向外扩展

  • 相关阅读:
    Mysql配置文件模板
    shell命令记录
    SuSE Linux Enterprise Server
    安装jdk1.8
    云南-第一个应用节点-ssh登录-卡顿的问题
    Python重新安装pip
    Centos6.5修改镜像为国内的阿里云源
    supervisord.conf
    Pandas连接Mysql数据库
    Vim速查命令简版
  • 原文地址:https://www.cnblogs.com/liyang31tg/p/4115514.html
Copyright © 2011-2022 走看看