CGRectMake & CGSizeMake

CGRectMake
Returns a rectangle with the specified coordinate and size values.

Declaration
SWIFT
func CGRectMake(_ x: CGFloat,
              _ y: CGFloat,
              _ width: CGFloat,
              _ height: CGFloat) -> CGRect
OBJECTIVE-C
CGRect CGRectMake ( CGFloat x, CGFloat y, CGFloat width, CGFloat height );
Parameters
x   
The x-coordinate of the rectangle’s origin point.
y   
The y-coordinate of the rectangle’s origin point.
width   
The width of the rectangle.
height   
The height of the rectangle.
Return Value
A rectangle with the specified location and dimensions.

Import Statement
OBJECTIVE-C
@import CoreGraphics;
SWIFT
import CoreGraphics

 

coordinate坐标的意思;rectangle矩形的意思;

 

 

CGSizeMake
Returns a size with the specified dimension values.

Declaration
SWIFT
func CGSizeMake(_ width: CGFloat,
              _ height: CGFloat) -> CGSize
OBJECTIVE-C
CGSize CGSizeMake ( CGFloat width, CGFloat height );
Parameters
width   
A width value.
height   
A height value.
Return Value
Returns a CGSize structure with the specified width and height.

Import Statement
OBJECTIVE-C
@import CoreGraphics;
SWIFT
import CoreGraphics

时间: 2024-08-09 04:52:11

CGRectMake & CGSizeMake的相关文章

iOS开发基础知识--碎片3

iOS开发基础知识--碎片3  iOS开发基础知识--碎片3 十二:判断设备 //设备名称 return [UIDevice currentDevice].name; //设备型号,只可得到是何设备,无法得到是第几代设备 return [UIDevice currentDevice].model; //系统版本型号,如iPhone OS return [UIDevice currentDevice].systemVersion; //系统版本名称,如6.1.3 return [UIDevice

OC基本数据类型,CGGeometry类定义几何元素的结构和操作几何元素的函数

官方地址: http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CGGeometry/Reference/reference.html 1.数据类型: CGFloat: 浮点值的基本类型CGPoint: 表示一个二维坐标系中的点CGSize: 表示一个矩形的宽度和高度CGRect: 表示一个矩形的位置和大小 typedef float CGFloat;// 32-bit typedef d

IOS开发中的CGFloat、CGPoint、CGSize和CGRect

1.数据类型: CGFloat: 浮点值的基本类型CGPoint: 表示一个二维坐标系中的点CGSize: 表示一个矩形的宽度和高度CGRect: 表示一个矩形的位置和大小 typedef float CGFloat;// 32-bit typedef double CGFloat;// 64-bit struct CGPoint { CGFloat x; CGFloat y; }; typedef struct CGPoint CGPoint; struct CGSize { CGFloat

[转]IOS开发中的CGFloat、CGPoint、CGSize和CGRect

http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CGGeometry/Reference/reference.html CGGeometry类定义几何元素的结构和操作几何元素的函数. 1.数据类型: CGFloat: 浮点值的基本类型CGPoint: 表示一个二维坐标系中的点CGSize: 表示一个矩形的宽度和高度CGRect: 表示一个矩形的位置和大小 typedef float C

CGGeometry类定义几何元素的结构和操作几何元素的函数。

1.数据类型: CGFloat: 浮点值的基本类型CGPoint: 表示一个二维坐标系中的点CGSize: 表示一个矩形的宽度和高度CGRect: 表示一个矩形的位置和大小 typedef float CGFloat;// 32-bit typedef double CGFloat;// 64-bit struct CGPoint { CGFloat x; CGFloat y; }; typedef struct CGPoint CGPoint; struct CGSize { CGFloat

走进swfit(二)CGRectMake

在OC里写一个动态Frame很简单,例如: btn.frame = CGRectMake(i*(320/tabArray.count), 0, 320/tabArray.count, 49); 但是到了swift里这么来写是行不通的,编译不通过,找了下写法如下 var button:UIButton = UIButton() var z = (idx)*135 var c = CGFloat(z) var x:CGFloat = 107.0 + c var frame = CGRectMake(

iphone绘图的几个基本概念CGPoint、CGSize、CGRect、CGRectMake、window(窗口)、视图(view)

我一般情况下不会使用interface builder去画界面,而是用纯代码去创建界面,不是装B,而是刚从vi转到xcode不久,不太习惯interface builder而已.当然如果需要我也会使用它.一个东西的存在没有绝对的好与坏,只是存在时间与空间决定了它的价值. (忘了讲了,我的环境是xcode4.2)首先要弄懂几个基本的概念. 一)三个结构体:CGPoint.CGSize.CGRect1.  CGPoint [plain] view plaincopy   /* Points. */

CGRectMake

1.基础知识——三个结构体 CGPoint 1 /* Points. */ 2 3 struct CGPoint { 4 CGFloat x; 5 CGFloat y; 6 }; 7 typedef struct CGPoint CGPoint; CGSize 1 /* Sizes. */ 2 3 struct CGSize { 4 CGFloat width; 5 CGFloat height; 6 }; 7 typedef struct CGSize CGSize CGRect 1 /* R

<iOS 导航栏>第一节:导航栏透明方法实现代码

说下导航栏的透明方法: 很多应用需要导航栏随着向上滑动,逐渐从透明变成不透明,很炫酷,大部分应用都在使用导航栏渐变效果,现附上代码然后直接将实现,一会讲下如何来实现,这一部分直接上代码. 先附上代码: 方法声明: #import <UIKit/UIKit.h> @interface IDSNavBarView : UIView - (instancetype)initWithFrame:(CGRect)frame titleImg:(UIImage *)aTitleImg; - (UILabe