|
@@ -65,10 +65,14 @@ class CardContentPicVideoCollectionViewLayout: UICollectionViewLayout {
|
|
|
|
|
|
}else{ //图片宽度大于图片高度
|
|
|
if (cardContentPicVideoModel?.width ?? 0) / (cardContentPicVideoModel?.height ?? 0) > 2 {
|
|
|
- return CGRect(x: 0, y: 0, width: (kScreenWidth-28), height: ((347 * (cardContentPicVideoModel?.height ?? 0)) / (cardContentPicVideoModel?.width ?? 0)) * kScaleWidth)
|
|
|
+ let height = 347 * (cardContentPicVideoModel?.height ?? 0)
|
|
|
+ let width = cardContentPicVideoModel?.width ?? 0
|
|
|
+ return CGRect(x: 0, y: 0, width: (kScreenWidth-28), height: (height / width) * kScaleWidth)
|
|
|
|
|
|
}else {
|
|
|
- return CGRect(x: 0, y: 0, width: 232 * kScaleWidth, height: ((232 * (cardContentPicVideoModel?.height ?? 0)) / (cardContentPicVideoModel?.width ?? 0)) * kScaleWidth)
|
|
|
+ let height = (232 * (cardContentPicVideoModel?.height ?? 0))
|
|
|
+ let width = (cardContentPicVideoModel?.width ?? 0)
|
|
|
+ return CGRect(x: 0, y: 0, width: 232 * kScaleWidth, height: (height / width) * kScaleWidth)
|
|
|
}
|
|
|
}
|
|
|
case 2:
|