码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-07-19 13:08:34      阅读:100      评论:0      收藏:0      [点我收藏+]

标签:

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

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

标签:

原文地址:http://www.cnblogs.com/fangchun/p/4658394.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!