Author Archives: wuxiao7813

(转)Apple LLVM 4.0的新特性

原文:

Xcode now includes the Apple LLVM Compiler version 4.0, including the following newObjective-C language features:

 - Default @synthesize: automatically synthesizes an @property when unimplemented
 - Objective-C literals: create literals for NSArray, NSDictionary, and NSNumber, just the same as the literals for NSString
 - Objective-C container subscripting: use '[]' syntax to access containers such as NSArray and NSDictionary

译文

 

  • @synthesize: 自动为@property添加synthesize (尼玛!!! 我们已经期待很久了!!!)
  • 语法: 创建NSArray, NSDictionary, NSNumber的时候, 可以像NSString那样写 (不懂? 下面解释!)
  • 容器下标(?): 用’[]‘来访问容器(例如NSArray和NSDictionary), 就像你在第一节C语言课上学的”arr[0]“, “arr[1]“那样. 不过这个似乎是允许在’[]‘中填入字符串的(NSDictionary).

下面举例解释下第二条:

NSArray

Previously:

array = [NSArray arrayWithObjects:a, b, c, nil];

Now:

array = @[a, b, c];

NSDictionary

Previously:

dict = [NSDictionary dictionaryWithObjects:@[o1, o2, o3] forKeys:@[k1, k2, k3]];

Now:

dict = @{k1: o1, k2: o2, k3: o3};

NSNumber

Previously:

NSNumber *number;
number = [NSNumber numberWithChar:'X'];
number = [NSNumber numberWithInt:12345];
number = [NSNumber numberWithUnsignedLong:12345ul];
number = [NSNumber numberWithLongLong:12345ll];
number = [NSNumber numberWithFloat:123.45f];
number = [NSNumber numberWithDouble:123.45];
number = [NSNumber numberWithBool:YES];

Now:

NSNumber *number;
number = @'X';
number = @12345;
number = @12345ul;
number = @12345ll;
number = @123.45f;
number = @123.45;
number = @YES;

iphone送修了

昨天撒了些水在桌上,iphone就后背湿了一些,没太注意。

擦干了看看问题不大继续使用,晚上插着mac在充电,一切正常。

早上起来一看,电没有充满,mac找不到iphone了,以为mac待机状态了。

重插连接线,没什么反应,用电源,没有反应,无法外音播放音乐,但有电话铃声。

无法,只得杀到三里屯apple store,没有预约的位置,让下面的人给我清理了一下,然后上了天才吧,一直不停的找他们,让他给我看看,终于有人空了出来,给我清理一下,然后还是没有用,直接补了一个预约,说给你修吧,估计3-5天,换主板,然后清空数据,可惜忘了照片还有不少没有备份⋯⋯

几天没有iphone用,看看这几天的android能不能给力点⋯⋯