判断给定的点是否被一个CGRect包含,可以用CGRectContainsPoint函数

BOOLcontains=CGRectContainsPoint(CGRectrect,CGPointpoint);

判断一个CGRect是否包含再另一个CGRect里面,常用与测试给定的对象之间是否又重叠

BOOLcontains =CGRectContainsRect(CGRectrect1,CGRectrect2);

判断两个结构体是否有交错.可以用CGRectIntersectsRect

BOOLcontains =CGRectIntersectsRect(CGRectrect1,CGRectrect2);

floatfloat_ =CGRectGetMaxX(CGRectrect);返回矩形右边缘的坐标

CGRectGetMinY返回矩形顶部的坐标

CGRectGetMidX返回矩形中心X的坐标

CGRectGetMidY返回矩形中心Y的坐标

CGRectGetMinX 返回矩形左边缘的坐标

CGRectGetMaxY返回矩形底部的坐标

CGRectInset((cgrect)(例如:fram.bouns), (float)a, (float)b;//将一个矩形上下a,左右加边界b;返回值是一个cgrect

CGRectOffset((cgrect), (float)a, (float)b);//作用将一个方框向左a向下b移动一定距离,产生一个新的方框

还有就是需要定义一些 策略    示例代码

#import <UIKit/UIKit.h>

@interface UIView (Frame)

@property (nonatomic, assign) CGFloat x;

@property (nonatomic, assign) CGFloat y;

@property (nonatomic, assign) CGFloat width;

@property (nonatomic, assign) CGFloat height;

@property (nonatomic, assign) CGPoint origin;

@property (nonatomic, assign) CGSize size; @end

#import "UIView+Frame.h"

@implementation UIView (Frame)

- (void)setX:(CGFloat)x {

CGRect frame = self.frame;

frame.origin.x = x;

self.frame = frame;

}

- (CGFloat)x {

return self.frame.origin.x;

}

- (void)setY:(CGFloat)y {

CGRect frame = self.frame;

frame.origin.y = y;

self.frame = frame;

}

- (CGFloat)y { return self.frame.origin.y; }

- (void)setWidth:(CGFloat)width { CGRect frame = self.frame; frame.size.width = width; self.frame = frame; }

- (CGFloat)width { return self.frame.size.width; }

- (void)setHeight:(CGFloat)height { CGRect frame = self.frame; frame.size.height = height; self.frame = frame; }

- (CGFloat)height { return self.frame.size.height; }

- (void)setOrigin:(CGPoint)origin { CGRect frame = self.frame; frame.origin = origin; self.frame = frame; }

- (CGPoint)origin { return self.frame.origin; }

-(void)setSize:(CGSize)size { CGRect frame = self.frame; frame.size = size; self.frame = frame; }

-(CGSize)size { return self.frame.size; }

@end

还可以扩展  bottom top 等

这样写了之后,工程里用的就很方便啦

CGRectMake 延伸的更多相关文章

  1. 采用MiniProfiler监控EF与.NET MVC项目(Entity Framework 延伸系列1)

    前言 Entity Framework 延伸系列目录 今天来说说EF与MVC项目的性能检测和监控 首先,先介绍一下今天我们使用的工具吧. MiniProfiler~ 这个东西的介绍如下: MVC Mi ...

  2. 采用EntityFramework.Extended 对EF进行扩展(Entity Framework 延伸系列2)

    前言 Entity Framework 延伸系列目录 今天我们来讲讲EntityFramework.Extended 首先科普一下这个EntityFramework.Extended是什么,如下: 这 ...

  3. 《高性能javascript》一书要点和延伸(下)

    第六章 快速响应的用户界面 本章开篇介绍了浏览器UI线程的概念,我也突然想到一个小例子,这是写css3动画的朋友都经常会碰到的一个问题: <head> <meta charset=& ...

  4. 【Python五篇慢慢弹(5)】类的继承案例解析,python相关知识延伸

    类的继承案例解析,python相关知识延伸 作者:白宁超 2016年10月10日22:36:57 摘要:继<快速上手学python>一文之后,笔者又将python官方文档认真学习下.官方给 ...

  5. 【NLP】条件随机场知识扩展延伸(五)

    条件随机场知识扩展延伸 作者:白宁超 2016年8月3日19:47:55 [摘要]:条件随机场用于序列标注,数据分割等自然语言处理中,表现出很好的效果.在中文分词.中文人名识别和歧义消解等任务中都有应 ...

  6. iOS - 分析JSON、XML的区别和解析方式的底层是如何实现的(延伸实现原理)

    <分析JSON.XML的区别,JSON.XML解析方式的底层是如何实现的(延伸实现原理)> (一)JSON与XML的区别: (1)可读性方面:基本相同,XML的可读性比较好: (2)可扩展 ...

  7. 转型?还是延伸?开源建站系统近乎推整套SNS社区解决方案

    转型?还是延伸?开源建站系统近乎推整套SNS社区解决方案 近乎(英文:Spacebuilder),作为.net领域的SNS社区建站系统代表之一,一直在技术开发领域算是兢兢业业,在Discuz!和Php ...

  8. json学习系列(6)JSONObject和JSONArray是JDK的集合部分延伸

    我一直觉得JSONObject和JSONArray是JDK集合部分的延伸,它们与JDK的List和Map一脉相承.通过研究JSONObject和JSONArray的结构,我们顺便也复习一下JDK的内容 ...

  9. 元素设置position:fixed属性后IE下宽度无法100%延伸

    元素设置position:fixed属性后IE下宽度无法100%延伸 IE bug 出现条件: 1.div1设置position:fixed属性,并且想要width:100%的效果. 2.div2(下 ...

随机推荐

  1. Flask调试

    1.AttributeError: 'NoneType' object has no attribute 'app' 原因:直接在py中调用视图函数,但没有上下文,导致出错 2.不转换html代码 { ...

  2. Log4net PatternLayout 参数

    Log4net PatternLayout 参数 来自: https://logging.apache.org/log4net/log4net-1.2.13/release/sdk/log4net.L ...

  3. ERROR: In &lt;declare-styleable&gt; MenuView, unable to find attribute android:preserveIconSpacing

    eclipse  sdk从低版本号切换到高版本号sdk的时候   v7包会包这个错ERROR: In <declare-styleable> MenuView, unable to fin ...

  4. iOS 画虚线

    UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(, , , )]; [self.view addSubvi ...

  5. 使用Spring框架入门一:基于XML配置的IOC/DI的使用

    一.Spring框架 1.方法一:逐项导入基础依赖包: spring-core.spring-beans.spring-context.spring-expression 2.方法二:最简洁的导入,直 ...

  6. JAVA 线程池入门事例

    线程池这个概念已经深入人心了,今天就是通过几个入门事例,学习一下线程池在JAVA中的应用. 一.大小固定的线程池——Executors.newFixedThreadPool() 下面咱们明确两个类: ...

  7. python2x与3x下使用urlretrieve下载文件

    1.python2x下urlretrieve方法: 直接将远程数据下载到本地. urllib.urlretrieve(url[, filename[, reporthook[, data]]]) 参数 ...

  8. 西数移动固态SSD

    好款推荐! 我可没有收广告费:哈哈哈 就是看着产品不错,喜欢小米! 西数出了SSD移动固态硬盘真心不错!     文章来源:刘俊涛的博客 欢迎关注,有问题一起学习欢迎留言.评论

  9. tpcc-mysql 系列一:安装使用

    1:安装epel包: rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm 2: yum i ...

  10. SpringBoot集成jdbcTemplate/JPA

    1.pom.xml <!-- jdbcTemplate 依赖 --> <dependency> <groupId>org.springframework.boot& ...