#import <Foundation/Foundation.h>
int main()
{
/*
1.NSRange/CGRange
2.NSPoint/CGPoint
3.NSSize/CGSize
4.NSRect/CGRct
*/
// NSRange/CGRange(location,length)
NSString *str = @"i love u";
// 查找"love"在字符串中的范围
NSRange r = NSMakeRange(2,4);
NSRange range = [NSString rangeOfString:@"love"];
NSLog(@"location = %ld, length = %ld", range.location,
range.length);
// CGPoint代表一个点
// p代表的点与p1代表的点相同
NSPoint p = NSMakePoint(50,100);
CGPoint p1 = CGPointMake(50,100); // 常用
// s代表的长宽与s1代表的长宽相同
NSSize s = NSMakeSize(20,50);
CGSize s1 = CGSizeMake(20,50);
// r代表的形状与r1代表的形状相同
NSRize r = NSMakeRize(0,0,20,50);
CGRize r1 = CGRizeMake(0,0,20,50);
CGRize r1 = CGRizeMake(CGPointMake(0,0),CGSizeMake(20,50));
CGRize r1 = CGRizeMake(CGPointZero,CGSizeMake(20,50));
return 0;
}
时间: 2024-10-16 01:01:36