CGFloat :表示一個浮點
CGPoint:表示一個點
CGsize:標示一個矩形,但只有高度和寬度
CGRect:表示一個矩形,並且有原點的位置。
CGRectZero:是一個高度為零,寬度為零,原點位置也為零,需要創建邊框但還不確定邊框大小和位置時,可以使用此常量
CGPointMake,CGRectMake,CGSizeMake 用來初始化
NSStringFromPoint,NSStringFromRect,NSStringFromSize 用於將Poing,rect,size轉換成字符串
code:
CGFloat f=1.2f;
CGPoint point=CGPointMake(1.2F, 2.3F);
CGRect cgrect=CGRectMake(1.2f, 2.3, 4.5, 5.6);
CGSize size=CGSizeMake(2.3, 3.2);
NSLog(@"float is %f",f);
NSLog(@"point is %@",NSStringFromPoint(point));
NSLog(@"cgrect is %@",NSStringFromRect(cgrect));
NSLog(@"size is %@",NSStringFromSize(size));
result
2013-05-09 15:29:25.522 test[1734:303] float is 1.200000
2013-05-09 15:29:25.523 test[1734:303] point is {1.2000000476837158, 2.2999999523162842}
2013-05-09 15:29:25.523 test[1734:303] cgrect is {{1.2000000476837158, 2.2999999999999998}, {4.5, 5.5999999999999996}}
2013-05-09 15:29:25.523 test[1734:303] size is {2.2999999999999998, 3.2000000000000002}