我这里有三个不同的阵列...
我环绕高尔夫三联赛(NSmubableAray), 并试图将最高4个结果(golfer三联赛以#s 字符串形式)存储到顶部四联赛(NSmubableAray), 然后我计划将最高数字的代号存储在数组顶部四联赛(NS MubableAray)中。
一个棘手的问题是,高尔夫三连队在99岁就出局了, 但我希望它表现得像零一样。 所以99号不应该被加到两个阵列中...
Example: golferThreeIcons {2,1,5,3,9}
环环经过后,我想让它显示像这样的东西...
{0, 2, 3, 4} - - - 0 等于 2 高尔夫三连 - - 2 等于 5 等于 3 个高尔夫三个图标
{2, 5, 3, 9} - -(只要与前四个图标 id对应,则以任何顺序排列)
NSMutableArray *topFourIconsId = [NSMutableArray arrayWithObjects: @"0", @"0", @"0", @"0", @"0" ,nil];
NSMutableArray *topFourIconsNum = [NSMutableArray arrayWithObjects: @"0", @"0", @"0", @"0", @"0" ,nil];
int *ids = 0;
for (NSString *s in golferThreeIconCounter) {
if(s != @"0") {
int sint = [s intValue];
int *idn = 0;
for(NSString *n in topFourIconsNum) {
int nint= [n intValue];
if(sint == 99 && nint == 0) {
NSString *idstring = [NSString stringWithFormat:@"%d", ids];
NSString *sintstring = [NSString stringWithFormat:@"%d", sint];
[topFourIconsId replaceObjectAtIndex:idn withObject:idstring];
[topFourIconsNum replaceObjectAtIndex:idn withObject:sintstring];
NSLog(@"IN %@",sintstring);
break;
}
else {
if (sint > nint) {
NSString *idstring = [NSString stringWithFormat:@"%d", ids];
NSString *sintstring = [NSString stringWithFormat:@"%d", sint];
[topFourIconsId replaceObjectAtIndex:idn withObject:idstring];
[topFourIconsNum replaceObjectAtIndex:idn withObject:sintstring];
NSLog(@"IN %@",sintstring);
break;
}
}
idn++;
}
}
ids++;
}