我有如下 NSMutableArray 数据。
(
{
Id = "-1";
NameEn = Country;
},
{
Id = 14;
NameEn = Iran;
},
{
Id = 11;
NameEn = Jordan;
},
{
Id = 5;
NameEn = "United Arab Emirates";
},
{
Id = 4;
NameEn = "Suadi Arabia";
},
{
Id = 3;
NameEn = Kuwait;
},
{
Id = 10;
NameEn = Yemen;
},
{
Id = 6;
NameEn = Oman;
},
{
Id = 12;
NameEn = Syria;
},
{
Id = 7;
NameEn = Qatar;
},
{
Id = 13;
NameEn = Lebanon;
},
{
Id = 1;
NameEn = Egypt;
},
{
Id = 8;
NameEn = "Bahrain Kingdom";
}
)
我想找到Id = 5的位置。
知道我该怎么做吗?
我试过下面。
NSString *myCountry = [[NSUserDefaults standardUserDefaults] valueForKey:@"mCountryId"];
NSUInteger indexOfTheObject = [feedsCountry indexOfObject: myCountry];
NSLog(@"indexOfTheObject===%i==%@", indexOfTheObject, myCountry);
if (NSNotFound == indexOfTheObject) {
NSLog(@"not found...");
}
但我得到not found...
mCountryId 的输出为 5。