gpt4 book ai didi

objective-c - 如何从 NSCollectionView 中删除所有项目?

转载 作者:行者123 更新时间:2023-12-03 16:35:23 24 4
gpt4 key购买 nike

我试图通过从 NSMutableArray 中删除所有项目来删除用户在 NSCollectionView 中添加的所有项目。它不起作用。

我只需要通过清除/删除NSCollectionView的所有项目来刷新/重新加载

最佳答案

试试这个

NSIndexSet* selectedIndexSet = [_lablesCollectionView selectionIndexes];
NSUInteger index = [selectedIndexSet firstIndex] ;
NSLog(@"index is %d", index);
[lablesArray removeObjectsAtArrangedObjectIndexes:selectedIndexSet];

希望有帮助。

关于objective-c - 如何从 NSCollectionView 中删除所有项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31849557/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com