我试图确定数组中的值是什么,然后在数组上实现更改,但我一开始就无法访问数组......
NSNumber *row = [NSNumber numberWithInt:recognizer.view.tag];
NSInteger *newRow = [row integerValue];
NSInteger *index = [selectedItems indexOfObject:row];//0=Not selected 1=selected;
NSLog(@"%@ & ",row);
if (index == 0) {
[selectedItems removeObjectAtIndex:newRow];
[selectedItems insertObject:@"1" atIndex: newRow];
[(UITableViewCell *)(recognizer.view) setAccessoryType:UITableViewCellAccessoryCheckmark];
} else {
[selectedItems removeObjectAtIndex: newRow];
[selectedItems insertObject:@"0" atIndex: newRow];;
[(UITableViewCell *)(recognizer.view) setAccessoryType:UITableViewCellAccessoryNone];
}
如您所见,我正在尝试从行变量(一个 NSNumber)中获取信息,并使用索引变量查找数组的值。我也在我的 onload() 中声明了这一点...
selectedItems = [NSArray arrayWithObjects: 0, 0, 0, nil];
问题是我收到所有这些警告说......
Incompatible integer to pointer conversion initializing 'NSInteger *' (aka 'int *') with an expression of type 'NSUInteger' (aka 'unsigned int');
每当我使用变量行或 newRow 时。如您所见, newRow 只是作为整数的行。我究竟做错了什么?