我将如何得到我的自定义集合视图单元格内声明GCSize的方法?

我有一个自定义视图单元格的集合视图..

我正在试图获取它定义高度的单元格的引用:

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { CGRect screenBound = [[UIScreen mainScreen] bounds]; CGSize screenSize = screenBound.size; CGFloat screenWidth = screenSize.width; MyCustomCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:DequeueMyCustomReusableCell forIndexPath:indexPath]; return CGSizeMake(screenWidth, [cell calculatedHeight]); } 

这是行不通的。我该怎么办?

这也不是:

 MyCustomCell *cell = (MyCustomCell *)[collectionView cellForItemAtIndexPath:indexPath];