当我的NSLog检查数的值它显示“0”条件总是失败虽然比较值似乎是正确的iOS中
NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile: path];
NSNumber *number=[data objectForKey:@"serial"];
NSLog(@"%@",number);
if(number ==0)
{
imgButton.hidden=YES;
}
但病情总是失败,我也改变了这样的代码
NSString *number=[data objectForKey:@"serial"]
NSLog(@"%@",number);
if(number == @"0")
{
imgButton.hidden=YES;
}
但是这里的情况也失败了,这是什么问题?
尝试使用“[数字的intValue] == 0” – Inoka