《iOS软件开发接密》
Chap 2,
1. 数据类型
* Objective-C数据类型
id = void *
* SEL
可当作函数指针来使用,但不是指针,准确地说是const char *
[object performSelector:@selector(doSomething)] == [object doSomething]
* 空
nil:对象; 发送消息给 nil,返回0,不会crash!
NULL:任何指针
NSNull:集合
Q:区别何在?
2. 字符串
* StringWithFormat = sprintf(...)
3. 线程
[NSThread detachNewThreadSelector:@selector(doSomething) toTarget:self withObject:NULL];
^线程方法名 ^ 对象 ^ 参数?
4. 消息
Q:NSNotificationCenter是同步的东东???
问题:以下程序无法cmpile???
#import<Foundation/Foundation.h>
//#include <stdio.h>
int main (int argc,constchar * argv[]) {
// insert code here...
// printf("Hello, World!\n");
NSLog(@"Hi there. ");
return 0;
}