首页 > 代码库 > 【Foundation Frame】Struct
【Foundation Frame】Struct
//
// main.m
// struct
//
// Created by mac on 14-12-2.
// Copyright (c) 2014年mac. All rights reserved.
//
#import<Foundation/Foundation.h>
#pragma mark基本数据类型----
voidbaseType()
{
//unsigned long %lu
NSUInteger i;
//long
NSInteger j;
//double
NSTimeInterval k;
}
#pragma结构体---------------
voidstructType()
{
//first type
NSRange range = {34,67};
NSLog(@"%lu,%lu",range.location,range.length);
//second type
NSRange range1 = {.location= 43, .length= 76};
NSLog(@"%lu,%lu",range1.location,range1.length);
//third type
NSRange range3 = NSMakeRange(456,789);
NSLog(@"%lu,%lu",range3.location,range3.length);
//example
NSString *str =@"Hello,NSStruct";
NSRange range4 = [strrangeOfString:@"Hello"];
NSLog(@"%lu,%lu",range4.location,range4.length);
//point
NSPoint point = NSMakePoint(0.0,0.0) ;
//size
NSSize size = NSMakeSize(34.2,123.1);
//rect
NSRect rect = NSMakeRect(0.0,0.0,234,231);
//CG开头的结构体
CGPoint point1 = CGPointMake(0.0,0.0);
CGSize size1 = CGSizeMake(34.2,123.1);
CGRect rect2 = CGRectMake(45.2,34.2,40,60);
CGPoint point2 = CGPointZero;
CGSize size2 = CGSizeZero;
CGRect rect3 = CGRectZero;
}
intmain(intargc, const char * argv[]) {
@autoreleasepool {
structType();
}
return 0;
}
// main.m
// struct
//
// Created by mac on 14-12-2.
// Copyright (c) 2014年mac. All rights reserved.
//
#import<Foundation/Foundation.h>
#pragma mark基本数据类型----
voidbaseType()
{
//unsigned long %lu
NSUInteger i;
//long
NSInteger j;
//double
NSTimeInterval k;
}
#pragma结构体---------------
voidstructType()
{
//first type
NSRange range = {34,67};
NSLog(@"%lu,%lu",range.location,range.length);
//second type
NSRange range1 = {.location= 43, .length= 76};
NSLog(@"%lu,%lu",range1.location,range1.length);
//third type
NSRange range3 = NSMakeRange(456,789);
NSLog(@"%lu,%lu",range3.location,range3.length);
//example
NSString *str =@"Hello,NSStruct";
NSRange range4 = [strrangeOfString:@"Hello"];
NSLog(@"%lu,%lu",range4.location,range4.length);
//point
NSPoint point = NSMakePoint(0.0,0.0) ;
//size
NSSize size = NSMakeSize(34.2,123.1);
//rect
NSRect rect = NSMakeRect(0.0,0.0,234,231);
//CG开头的结构体
CGPoint point1 = CGPointMake(0.0,0.0);
CGSize size1 = CGSizeMake(34.2,123.1);
CGRect rect2 = CGRectMake(45.2,34.2,40,60);
CGPoint point2 = CGPointZero;
CGSize size2 = CGSizeZero;
CGRect rect3 = CGRectZero;
}
intmain(intargc, const char * argv[]) {
@autoreleasepool {
structType();
}
return 0;
}
【Foundation Frame】Struct
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。