Arclin

Advocate Technology. Enjoy Technology.

0%

发现一个api

发现一个好用的api,用于找出selectedItem 在 dataSource 里面的位置,适用于tableView和collectionView

1
2
3
4
5
6
NSIndexSet *indexSet = [self.photos indexesOfObjectsPassingTest:^BOOL(DKPhoto * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([self.selectedPhotoArray containsObject:obj]) {
return YES;
}
return NO;
}];