


我在UITableViewCell中有collectionView,在UICollectionViewCell中我有UImageView,当我运行项目时,有一些我不想要的空闲空间:我如何修复它(通过代码或故事板-无关紧要)
发布于 2019-05-28 19:43:56
你应该通过代码来修复它。您可以使用UICollectionViewDelegateFlowLayout方法管理两个UICollectionView单元格之间的间距。
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: collectionView.frame.width, height: collectionView.frame.height)
}在上述方法中提供单元格的高度和宽度。
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}上述方法用于垂直滚动网格,该值表示连续行之间的最小间距。对于水平滚动网格,此值表示连续列之间的最小间距。
https://stackoverflow.com/questions/56340237
复制相似问题