我有一个按钮,单击它我将当前引号的索引存储到一个数组中。问题是它覆盖了同一个对象。如何使用不同的对象更改它NSNumber
以存储在 中NSMutableArray
?
[someButton setImage:[UIImage imageNamed:@"add_favoritegold.png"] forState:UIControlStateHighlighted];
NSUserDefaults *favoriteQuotes = [NSUserDefaults standardUserDefaults];
NSMutableArray *ListOfIndex= [[NSMutableArray alloc] init];
//Want to change with diffrent objecy
**NSNumber* Wrapped = [NSNumber numberWithInt:index];**
[ListOfIndex addObject:Wrapped];
int xOut = [[ListOfIndex lastObject] intValue];
NSLog(@"%d",xOut);
[favoriteQuotes setObject:ListOfIndex forKey:@"Indexes"];