嗯,這是我的代碼:isEqualToString誤會我的意思結果
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSLog(@"Row %i at View: %@",indexPath.row, [delegate.my_condition objectAtIndex:indexPath.row]);
if ([@"0" isEqualToString:[delegate.my_condition objectAtIndex:indexPath.row]]){
NSLog(@"Store is closed");
} else {
NSLog(@"Store is open");
,並在日誌中我看到:
2012-08-29 22:33:59.434 MyApp[2593:c07] Row 0 at View: 0
2012-08-29 22:33:59.435 MyApp[2593:c07] Store is open
2012-08-29 22:33:59.437 MyApp[2593:c07] Row 1 at View: 0
2012-08-29 22:33:59.438 MyApp[2593:c07] Store is open
2012-08-29 22:33:59.440 MyApp[2593:c07] Row 2 at View: 0
2012-08-29 22:33:59.441 MyApp[2593:c07] Store is open
我確實認爲這個值是0,但我沒有看到,如果子句,但是else子句。
這是爲什麼?
myCondition is NSMutableArray
這是我如何將項目添加到我的NSMutableArray:
NSString *parsed=[res objectForKey:@"Data"];
[delegate.my_condition addObject:parsed];
myCondition中有哪些類型的對象? –