博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[CGGeometry]CGRectInset解析
阅读量:4486 次
发布时间:2019-06-08

本文共 1759 字,大约阅读时间需要 5 分钟。

Returns a rectangle that is smaller or larger than the source rectangle, with the same center point.

返回一个使用同样的中点比源矩形小或大的矩形。

Declaration

SWIFT

func CGRectInset(rect,

               dxCGFloat,
               dyCGFloat) -> 

OBJECTIVE-C

CGRectInset rectdxdy );

Parameters

rect

The source CGRect structure. 源CGRect结构

dx

The x-coordinate value to use for adjusting the source rectangle. To create an inset rectangle, specify a positive value. To create a larger, encompassing rectangle, specify a negative value.

用来调整源矩形的x坐标值。规定一个正值来嵌入一个矩形。规定一个负值来创建一个更大的,包含源矩形的矩形。

dy

The y-coordinate value to use for adjusting the source rectangle. To create an inset rectangle, specify a positive value. To create a larger, encompassing rectangle, specify a negative value.

用来调整源矩形的x坐标值。规定一个正值来嵌入一个矩形。规定一个负值来创建一个更大的,包含源矩形的矩形。

Return Value

A rectangle. The origin value is offset in the x-axis by the distance specified by the dx parameter and in the y-axis by the distance specified by the dy parameter, and its size adjusted by (2*dx,2*dy), relative to the source rectangle. If dx and dy are positive values, then the rectangle’s size is decreased. If dx and dy are negative values, the rectangle’s size is increased.

一个矩形。原点值是通过dx参数确定的离x轴距离和通过dy参数确定的离y轴距离,它的大小通过相对于源矩形,(2*dx, 2*dy)来调整。如果dx和dy是正值,那么矩形的大小是减小的。如果dx和dy是负值,那么矩形的大小是增加的。

Discussion

The rectangle is standardized and then the inset parameters are applied. If the resulting rectangle would have a negative height or width, a null rectangle is returned.

如果矩形是标准的那么嵌入参数会被应用。如果结果矩形将会有一个负值的高或者宽度,将会返回一个nil空矩形。(PS:意思是说frame是正值就会应用参数,如果frame是负值则会返回一个nil)

Import Statement

import CoreGraphics

需要载入 CoreGrapghics(PS:不在UIKit里面吗)

Availability

Available in iOS 2.0 and later.

 

纯属原创,转载请注明!

转载于:https://www.cnblogs.com/baaingSheep/p/4278389.html

你可能感兴趣的文章
linux yum命令详解
查看>>
汇编语言笔记10-CALL和RET指令
查看>>
JavaScript不用临时变量交换两个变量的值的七种解决方案
查看>>
插入排序算法--Java实现
查看>>
android软键盘控制
查看>>
自定义LinkedList实现
查看>>
HDU 5306 线段树
查看>>
php输出json 对象{‘code’:200,'data':对象模式}
查看>>
springBean的生命周期
查看>>
【eclipse】启动不了报错java was started but returned exit code=13
查看>>
本地yum源 、阿里yum源、163yum源的配置安装
查看>>
codeforce 604B More Cowbell
查看>>
uvalive 3938 "Ray, Pass me the dishes!" 线段树 区间合并
查看>>
html中事件调用JavaScript函数时有return与没有return的区别
查看>>
[转帖]ASP.NET4中不要相信Request.Browser.Cookies,Form验证要用UseCookies
查看>>
Windows7中安装内存与可用内存不一致的解决办法
查看>>
HDU3065 AC自动机
查看>>
BUAA_OO_第一次作业总结
查看>>
数据结构-第10周作业(二叉树的创建和遍历算法)
查看>>
Java日志框架(二)
查看>>