如何获得UICollectionView的矩形
我想在UICollectionView中find节标题的框架。 对于UITableView我有类似的情况,为此,我可以通过下面的方法得到它的结果:
CGRect rect = [self.tableView rectForHeaderInSection:section];
有没有办法在UICollectionView中获得相同的结果? 谢谢!
对不起大家。 这实际上很简单。
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:section]; UICollectionViewLayoutAttributes *attributes = [self.collectionView layoutAttributesForSupplementaryElementOfKind:UICollectionElementKindSectionHeader atIndexPath:indexPath]; CGRect rect = [attributes frame];