我有一个问题,我使用tableview内部的collectionView但我很困惑,关于如何自定义每个sell sizewidth和spacing看到屏幕截图,我的单元格文本正在切割。关于食物我有不同的类别,我想根据类别展示产品,还想要每个细胞的边界半径和阴影颜色。在截图中,每个单元格都有背景颜色和文本不显示适当的感谢提前。
MyCode:
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
switch row {
case 0:
return CGSize(width: self.collectionView.bounds.width / 2 , height: self.bounds.height)
case 1:
return CGSize(width: self.collectionView.bounds.width / 3, height: self.bounds.height)
case 2:
return CGSize(width: self.collectionView.bounds.width / 1 - 50, height: self.bounds.height)
default:
return CGSize(width: 100, height: 100)
}
}
图像限制
TextField Constaints