0

我正在尝试将数字存储在 NSMutableArray 中,并像这样包装它们:

-(IBAction)opUp:(id)sender{
    opBool = YES;
    opNum = [sender tag];
    [numArray addObject:[NSNumber numberWithLong:number2]];
    [opArray addObject:[NSNumber numberWithInt:opNum]];
    number1 = 0;
    number2 = 0;
    opNum = 0;
    NSLog(@"Operand %i", opNum);
    NSLog(@"%i, %i", numArray.count, opArray.count);
 }

但是当我稍后用这个给他们打电话时:

    final2 = [numArray objectAtIndex:i];
    operthing = [opArray objectAtIndex:i];

我收到此错误消息:

操作等于 111526320

'operthing' 不应该超过 20。有人可以帮我解决这个问题吗?谢谢。

4

1 回答 1

2
operthing = [[opArray objectAtIndex:i] intValue];
于 2012-07-09T21:30:32.260 回答