BOOL和bool
BOOL 和 bool 不是同一个对象,不能混为一谈。
上一个例子吧:
bool b1 = true;
BOOL b2 = true;
bool b3 = 11;
BOOL b4 = 11;
if(b1) NSLog(@"b1 is true");
if(b2) NSLog(@"b2 is true");
if(b3) NSLog(@"b3 is true");
if(b4) NSLog(@"b4 is true");
输出结果:
b1 is true;
b2 is true;
b3 is true;
b4没有输出。
输出结果: