Objective - C学习 (Foundation框架)-- 01结构体

NSRange (location length)

"I love oc"
NSRange r = NSMakeRange(2,4)

 

NSString *str = @"i love you";

NSRange range = [str rangeofString:@"love"];

NSLog(@"loc = %ld, length = %ld",range.location, range.length);

找不到length = 0,location = NSNotFound == -1(涉及符号位)

 

NSPoint\CGPoint 跨平台

CGPoint p = NSMakePoint(10, 10);
NSPoint p = CGPointMake(20, 20);

CGSize s = NSMakeSize(20, 20);
NSSize s = CGSizeMake(100,100);

NSRect\CGRect(CGPoint CGSize)
CGRect r = CGRectMake(0, 0, 2, 3);

origin.x
origin.y
sieze.width
sieze.height

NSLog("%@",[NSStringFromeSize(s)]);
NSStringFromeRect(r)

CGPointZero == CGPointMake(0, 0)
CGRect r1 = {CGPointZero, CGSizeMake(100, 100)};

BOOL b = CGPointEqualToPoint(CGPointMake(10, 10), CGPointMake(10, 20));
CGRectEqualToRect

BOOL b = CGRectContainsPoint(CGRectMake(40, 50, 60, 70), CGPointMake(80, 80));
CG = CoreGraphics框架

NS = NextStep 的 Foundation

posted @ 2015-07-19 11:34  JonyFang  阅读(133)  评论(0编辑  收藏  举报