當我的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