【发布时间】:2013-04-28 10:50:26
【问题描述】:
我将不同的代码保存在一个数组中,现在想检查一个代码是否在数组中。
我搜索了一下,但没有任何工作......
您可以在这里看到我的数组的外观:
2013-04-28 12:43:23.877 myApp[9422:907] PushArray: (
{
code = 123;
titel = "Test 01";
},
{
code = 456;
titel = "Test 02";
},
{
code = 789;
titel = "Test 03";
}
)
我试过这个来检查:
NSString *code = [NSString stringWithFormat:@"123"];;
if ([PushArray containsObject:code]) {
NSLog(@"Code true!");
}else {
NSLog(@"Code false!");
}
但是每次我得到“Code false!”回来...
【问题讨论】:
标签: xcode arrays nsarray contains