右列图片被截断。例如,右边的粉色狮子应该基本对称,但显然不是。这是我配置imageCell的方式。
func configureCellWithImage(image: Image){
let iV = self.imageView
iV.setImageWithURL(image.thumbURL)
if(image.aspectRatio < 1.62){
iV.contentMode = UIViewContentMode.ScaleAspectFit
}else{
iV.contentMode = UIViewContentMode.ScaleAspectFill
}
}
这就是我如何返回单元格的大小。
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
let size = CGSize.init(width: screenSize.width/2 - 1, height: screenSize.width/2 * 1.62 - 1)
return size
}
帮助感谢。谢谢。
编辑:
我不知道为什么UIView的是那里的201宽度应该是159.我将如何访问这个观点?我应该只有CollectionView,imageCell和UIImageView。
你确定,你的收藏视图布局'minimumInteritemSpacing'是1? – Johnykutty