2014-11-19 5 views
1

Я хочу найти кадр заголовка раздела в UICollectionView. У меня аналогичная ситуация для UITableView, и для этого, я смог его прямоугольник, выполнив:Как получить прямой UICollectionView

CGRect rect = [self.tableView rectForHeaderInSection:section]; 

Есть ли способ, чтобы получить тот же результат в UICollectionView? Благодаря!

ответ

3

Извините, ребята. Это было действительно легко.

NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:section]; 
UICollectionViewLayoutAttributes *attributes = [self.collectionView layoutAttributesForSupplementaryElementOfKind:UICollectionElementKindSectionHeader atIndexPath:indexPath]; 
CGRect rect = [attributes frame]; 
Смежные вопросы