NSRange
NSRange range = [self.displayLabel.text rangeOfString:@"."];
typedef struct _NSRange {
NSUInteger location;
NSUInteger length;
} NSRange;
如果字符串中未包含字符,那么range.location=NSNotFoundCGFloat
Just a floating point number, but we always use it for graphics.
CGPoint
C struct with two CGFloats in it: x and y.
CGPoint p = CGPointMake(34.5, 22.0); p.x += 20; // move right by 20 points
CGSize
C struct with two CGFloats in it: width and height.
CGSize s = CGSizeMake(100.0, 200.0);
s.height += 50; // make the size 50 points taller
CGRect
C struct with a CGPoint origin and a CGSize size.
CGRect aRect = CGRectMake(45.0, 75.5, 300, 500);
aRect.size.height += 45; // make the rectangle 45 points taller
aRect.origin.x += 30; // move the rectangle to the right 30 points
Enumeration
NSDictionary *myDictionary = ...;
for (id key in myDictionary) {
// do something with key here
id value = [myDictionary objectForKey:key];
// do something with value here }
Think of @“string” as autoreleased
本文介绍了Core Graphics中的基本数据类型,包括NSRange用于文本范围标识、CGFloat用于图形操作中的浮点数表示、CGPoint和CGSize定义位置及大小、CGRect定义矩形区域等。此外还简单提及了NSDictionary的遍历方式。
1728

被折叠的 条评论
为什么被折叠?



