摘要: //set集合的操作 //便利初始化函数 NSSet *set1 = [[NSSet alloc] initWithObjects:@"aa", @"BB", @"CC", nil]; //便利构造器 NSSet *set2 = [NSSet setWithObjects:@"AA... 阅读全文
posted @ 2015-09-18 15:53 Nicat 阅读(355) 评论(0) 推荐(0) 编辑
摘要: -(id) initWithChar : (char) value;-(id) initWithInt : (int) value;...其他略装箱 将基础数据变成对象int i = 3;NSInteger * nsi = [NSNumber initWithInt:i]; //?是否正确,请调试拆... 阅读全文
posted @ 2015-09-18 15:53 Nicat 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 1.初始化char *str1="C string";//这是C语言创建的字符串NSString *str2=@"OC string";//ObjC字符串需要加@,并且这种方式创建的对象不需要自己释 放内存//下面的创建方法都应该释放内存NSString *str3=[[NSString alloc... 阅读全文
posted @ 2015-09-18 15:52 Nicat 阅读(188) 评论(0) 推荐(0) 编辑
摘要: //set可变集合//便利初始化函数分配大小NSMutableSet *mutableSet1 = [[NSMutableSet alloc] initWithCapacity:3];NSMutableSet *mutableSet2 = [NSMutableSet setWithCapacity:... 阅读全文
posted @ 2015-09-18 15:52 Nicat 阅读(272) 评论(0) 推荐(0) 编辑
摘要: int main(int argc, const char * argv[]) { @autoreleasepool { // insert code here... // 第一种赋值的方式 NSRange rg1={3,5};//结构体 // 第二种赋值的方式 ... 阅读全文
posted @ 2015-09-18 15:51 Nicat 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #importintmain(intargc,constchar* argv[]) { @autoreleasepool{ NSRectr=NSMakeRect(10,5,100,200);//NSRect其实就是CGRect //这种方式比较常见 NSRectr2=CGRectMake(... 阅读全文
posted @ 2015-09-18 15:51 Nicat 阅读(172) 评论(0) 推荐(0) 编辑
摘要: #import int main(int argc, const char * argv[]) { @autoreleasepool { // insert code here... NSSize s=NSMakeSize(10, 15);//NSSize其实就是CGSize /... 阅读全文
posted @ 2015-09-18 15:51 Nicat 阅读(787) 评论(0) 推荐(0) 编辑
摘要: #import int main(int argc, const char * argv[]) { @autoreleasepool { // insert code here... NSPoint p=NSMakePoint(10, 15); //NSPoint其实就CGPoi... 阅读全文
posted @ 2015-09-18 15:49 Nicat 阅读(394) 评论(0) 推荐(0) 编辑
摘要: NSMutableArray *array1=[NSMutableArray arrayWithObjects:@"1",@"3",@"2", nil]; //NSLog(@"%@",array1); /*结果: ( 1, 3, 2 ) */ ... 阅读全文
posted @ 2015-09-18 15:48 Nicat 阅读(259) 评论(0) 推荐(0) 编辑
摘要: /*可变字符串,注意NSMutableString是NSString子类*///注意虽然initWithCapacity分配字符串大小,但是不是绝对的不可以超过此范围,声明此变量对 性能有好处NSMutableString *str1= [[NSMutableString alloc] initWi... 阅读全文
posted @ 2015-09-18 15:48 Nicat 阅读(108) 评论(0) 推荐(0) 编辑
摘要: Person *person1=[[Person alloc]initWithName:@"Kenshin"]; Person *person2=[[Person alloc]initWithName:@"Kaoru"]; Person *person3=[[Person all... 阅读全文
posted @ 2015-09-18 15:47 Nicat 阅读(423) 评论(0) 推荐(0) 编辑
摘要: NSDictionary *dic1=[NSDictionary dictionaryWithObjectsAndKeys: @"1",@"a", @"2",@"b", @"3",@"c", @"2",@"d", nil]; NSLog(@"%zi",[dic... 阅读全文
posted @ 2015-09-18 15:46 Nicat 阅读(1015) 评论(0) 推荐(0) 编辑
摘要: NSDictionary *dic1=[NSDictionary dictionaryWithObjectsAndKeys: @"1",@"a", @"2",@"b", @"3",@"c", @"2",@"d", nil]; //遍历1 //for (i... 阅读全文
posted @ 2015-09-18 15:45 Nicat 阅读(1079) 评论(0) 推荐(0) 编辑
摘要: #import int main(int argc, const char * argv[]) { @autoreleasepool { NSDate *date1=[NSDate date];//获得当前日期 NSLog(@"%@",date1); //结果:2014-07-16 0... 阅读全文
posted @ 2015-09-18 15:44 Nicat 阅读(158) 评论(0) 推荐(0) 编辑
摘要: NSDictionary *dic1=[NSDictionary dictionaryWithObject:@"1" forKey:@"a"]; NSLog(@"%@",dic1); /*结果: { a = 1; } */ //常用的方式 NS... 阅读全文
posted @ 2015-09-18 15:44 Nicat 阅读(290) 评论(0) 推荐(0) 编辑
摘要: NSObject *obj=[[NSObject alloc]init]; NSArray *array=[[NSArray alloc] initWithObjects:@"abc",obj,@"cde",@"opq",@25, nil]; //方法1 随便 //int i=0;... 阅读全文
posted @ 2015-09-18 15:43 Nicat 阅读(221) 评论(0) 推荐(0) 编辑
摘要: //方法1,使用自带的比较器//compare是数组自带的比较方法NSArray *array=[NSArray arrayWithObjects:@"3",@"1",@"2", nil];NSArray *array2= [array sortedArrayUsingSelector:@selec... 阅读全文
posted @ 2015-09-18 15:42 Nicat 阅读(234) 评论(0) 推荐(0) 编辑
摘要: NSArray *array=[NSArray arrayWithObjects:@"1",@"2",@"3", nil]; NSArray *array2=[array arrayByAddingObject:@"4"];//注意此时array并没有变 //NSLog(@"%@",ar... 阅读全文
posted @ 2015-09-18 15:40 Nicat 阅读(316) 评论(0) 推荐(0) 编辑
摘要: //NSArray长度不可变所以初始化的时候就赋值,并且最后以nil结尾//此外需要注意NSArray不能存放C语言的基础类型NSObject *obj=[[NSObject alloc]init];NSArray *array1=[[NSArray alloc] initWithObjects:@... 阅读全文
posted @ 2015-09-18 15:39 Nicat 阅读(9451) 评论(0) 推荐(0) 编辑
摘要: [root@yan-001 ~] # uname -a # 查看内核/操作系统/CPU信息的linux系统信息命令[root@yan-001 ~] # head -n 1 /etc/issue # 查看操作系统版本,是数字1不是字母L[root@yan-001 ~] # cat /proc/cpui... 阅读全文
posted @ 2015-09-18 15:35 Nicat 阅读(1182) 评论(0) 推荐(0) 编辑