iOS Developer

Object-C 细微知识点

2017-01-19  本文已影响59人  践行者

关于实例变量与属性

@interface myClass
{
@public
NSMutableArray * tempArray;
}

@property (nonatomic,copy) NSArray * tempArray;
@end

BOOL 陷阱

整形的转换为BOOL 型的时候要小心。

BOOL 在Objective-C里被定义为unsigned char,这意味着它不仅仅只有YES (1)和NO (0)两个值。不要直接把整形强制转换为BOOL 型。
对BOOL值使用逻辑运算(&&, ||, ! )都是有效的。

常量

上一篇 下一篇

猜你喜欢

热点阅读