yos*_*ech 3 objective-c ios cgrect uicollectionviewlayout
我想在 UICollectionView 中找到部分标题的框架。我对 UITableView 有类似的情况,为此,我能够通过执行以下操作来获得它的 rect:
CGRect rect = [self.tableView rectForHeaderInSection:section];
Run Code Online (Sandbox Code Playgroud)
有没有办法在 UICollectionView 中获得相同的结果?谢谢!
对不起大家。其实很简单。
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:section];
UICollectionViewLayoutAttributes *attributes = [self.collectionView layoutAttributesForSupplementaryElementOfKind:UICollectionElementKindSectionHeader atIndexPath:indexPath];
CGRect rect = [attributes frame];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1269 次 |
| 最近记录: |