Open nellace opened 9 years ago
- (void)addButtonClicked:(id)sender { int a[6] = {1, 2, 5, 7, 9, 22}; NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet]; NSMutableArray *arr = [NSMutableArray array]; NSMutableArray *stat = [NSMutableArray array]; for (int i = 0; i < 6; i++) { [indexSet addIndex:a[i]]; [arr addObject:[NSNumber numberWithInt:1]]; [stat addObject:[NSNumber numberWithInt:BOOK_UNSELECTED]]; } [_bookArray insertObjects:arr atIndexes:indexSet]; [_bookStatus insertObjects:stat atIndexes:indexSet]; [_bookShelfView insertBookViewsAtIndexs:indexSet animate:YES];
the random number in indexset is bound to beyond bounds _bookArray,change to int a[6] = {0, 1, 2, 3, 4, 5 } fix it; thx for ur code ,I learned a lot
the random number in indexset is bound to beyond bounds _bookArray,change to int a[6] = {0, 1, 2, 3, 4, 5 } fix it; thx for ur code ,I learned a lot