セルのサイズを設定するための使用collectionViewのデリゲート、
のObjective-C
- (CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout*)collectionViewLayout
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"SETTING SIZE FOR ITEM AT INDEX %d", indexPath.row);
//Calculate the height required for tableView inside the cell and set it to the cell
return CGSizeMake(80, 80);
}
スウィフト
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
NSLog(@"SETTING SIZE FOR ITEM AT INDEX %d", indexPath.row);
//Calculate the height required for tableView inside the cell and set it to the cell
return CGSizeMake(80, 80);
}
それはあなたのお役に立てば幸いです。
[Dynamic size UICollectionView cell]の可能な複製(http://stackoverflow.com/questions/23760275/dynamic-size-uicollectionview-cell) – 7vikram7