Reputation: 11730
I am trying to remove all the items that user has added in NSCollectionView
by removing all items from NSMutableArray
. It's not working.
I just need to Refresh/Reload by Clear/Remove all items of the NSCollectionView
Upvotes: 2
Views: 769
Reputation: 11730
//remove/clear all items from NSCollectionView
for (int i = 0; i < [[arrayController arrangedObjects] count]; i++) {
[arrayController removeObjectAtArrangedObjectIndex:i];
i--;
}
Upvotes: 1
Reputation: 2220
Try this
NSIndexSet* selectedIndexSet = [_lablesCollectionView selectionIndexes];
NSUInteger index = [selectedIndexSet firstIndex] ;
NSLog(@"index is %d", index);
[lablesArray removeObjectsAtArrangedObjectIndexes:selectedIndexSet];
Hope it helps.
Upvotes: 1