标签:
底层封装是使用了typedef定义的结构体
1 typedef struct _NSRange{ 2 int location; 3 int length; 4 } NSRange;
1 NSRange range = {1, 2}; 2 NSRange range2 = {.location = 1, .length = 2}; 3 NSRange range3 = NSMakeRange(1, 2);
1 void point() 2 { 3 NSPoint p; 4 p.x = 1; 5 p.y = 2; 6 7 p = NSMakePoint(4, 2); 8 9 p = CGPointMake(11, 33); 10 11 NSString *str = NSStringFromPoint(p); 12 NSLog(@"The point is %@", str); 13 }
1 void size() 2 { 3 NSSize size; 4 size.width = 100; 5 size.height = 90; 6 7 size = NSMakeSize(42, 55); 8 9 size = CGSizeMake(63, 77); 10 11 NSString *str = NSStringFromSize(size); 12 NSLog(@"The size is %@", str); 13 }
1 void rect() 2 { 3 NSRect r; 4 r.origin.x = 10; 5 r.origin.y = 12; 6 r.size.height = 44; 7 r.size.width = 62; 8 9 r = NSMakeRect(13.11, 42.11, 42.55, 11.44); 10 11 r = CGRectMake(13.11, 42.11, 42.55, 11.44); 12 13 }
标签:
原文地址:http://www.cnblogs.com/wvqusrtg/p/4503948.html