NSLog(@"%o",i); 八进制输出变量i NSLog(@"%#o",i); 八进制前加0 NSLog(@"%x",i); 十六进制输出变量i NSLog(@"%#x",i); 十六进制前加0x(abcdef是小写) NSLog(@"%#X,i"),(ABCDEF是大写)
interface 中: -:表示是实例方法,+:表示是类方法(比如alloc函数就是类方法)
char *str = "hello"; NSLog(@"%@",str); 没有错误,但是没有得到想要的结果 NSLog(@"%s",str);结果正确
@property int x; @synthesize x; // it means getter method x ,and setter method setX [myInstance x]; == myInstance.x; [myInstance setX:13]; == (myInstance.x = 13;)
两个参数 -(void) setA:(int) a setB:(int) b; 或者 -(void) set:(int) a:(int) b
Category: @interface Fraction:NSObject {} @interface Fraction (MathOps)
release dealloc两个的区别就是,dealloc直接销毁内存,release是将reference count-1(如果对象没有其他的引用时,release 和 dealloc的作用是一样的)
NSFileManager *fm = [[NSFileManager alloc] init]; NSString *fName = [@"~/testfile" stringByExpandingTildeInPath];//“~”需要扩展才能够使用 [fm fileExistsAtPath:fName];
|