4
通过搜索如何在UICollectionViewController
中调整单元格大小(宽度和高度),我感到头痛。随着UITableViewController
有方法:UICollectionViewController如何调整单元格大小?
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
但随着UICollectionViewController
我找不到这样做编程的方法。
我有一个UICollectionViewCell
,但它并不明显。
如何更改UICollectionViewController
中单元格的大小?
不幸的是,这种方法被称为[创建细胞之前( http://stackoverflow.com/questions/13750428/resize-uicollectionview-cells-after-their-data-has-been-set)。因此,如果您需要根据不同的内容大小来调整单元格大小,则它不起作用。 – johnnieb
无论如何根据内容大小的细胞没有做繁琐的手动编码? – Patrick
我不认为有任何方法可以完全自动完成,但您仍然可以获得自动布局的好处。这里有一个方法的文章:http://blog.amyworrall.com/post/66085151655/using-auto-layout-to-calculate-table-cell-height – hukir