IOS自学
UI结构体:
1 点坐标结构体
NSPoint等价于CGPoint;
结构体成员有CGFloat x,CGFloat y;
NEW方法:CGPoint r1=CGPointMake(10,20);//括号内的数值为坐标轴X=10;Y=20;
返回值:点的坐标 return r1;
2 字符串的位置和长度
结构体成员有:location 和 length
NSRange(location length)
返回值为位置
NSString *str=@"hello world!";
NSRange range=[str rangeOfString:@"or"];
NSLog(@"loc=ld%,length=ld%",str.location,str.length);
3 界面代码
NSSize等价于CGSize //UI界面的大小
结构体成员有:width ,height;
NEW方法:NSSize size=NSSizeMake(100,200); //括号内的width=100;height=200;
4 界面视图代码
NSRect等价于CGRect;
结构体成员:
CGPoint.CGFloat x
CGPoint.CGFloat y
CGSize.width
CGSize.height
NSRect rect=NSRectMake(10,20,100,200);
//这里rect.CGPoint.CGFloatx=10,rect.CGPoint.CGFloaty=20,rect.CGSize.widht=100,rect.CGSize.height=200;