UICollectionView节中的单元格数

Ale*_*xey 8 iphone objective-c uicollectionview

如何计算该部分的单元格数?我需要知道细胞选择过程中细胞的数量.

hem*_*hav 18

将此方法用于集合视图以查找节中的项目数

- (NSInteger)numberOfItemsInSection:(NSInteger)section;
Run Code Online (Sandbox Code Playgroud)

您可以使用您的UICollectionView对象来调用它.

NSInteger numberOfItems = [myCollectionView numberOfItemsInSection:2];
Run Code Online (Sandbox Code Playgroud)

其中2是您要查找项目数的部分.