diff --git a/Yep/Views/Cells/ProfileSocialAccount/ProfileSocialAccountImagesCell.swift b/Yep/Views/Cells/ProfileSocialAccount/ProfileSocialAccountImagesCell.swift index 642f7454..baef91c4 100644 --- a/Yep/Views/Cells/ProfileSocialAccount/ProfileSocialAccountImagesCell.swift +++ b/Yep/Views/Cells/ProfileSocialAccount/ProfileSocialAccountImagesCell.swift @@ -27,6 +27,36 @@ class ProfileSocialAccountImagesCell: UICollectionViewCell { return } + // 对于从左到右排列,且左边的最新,要处理数量不足的情况 + + var shots: [DribbbleWork.Shot?] = dribbbleWork.shots.map({ $0 }) + + let imageViews = [ + imageView3, + imageView2, + imageView1, + ] + + // 不足补空 + if shots.count < imageViews.count { + + let empty: [DribbbleWork.Shot?] = Array(0..<(imageViews.count - shots.count)).map({ _ in + return nil + }) + + shots.insertContentsOf(empty, at: 0) + } + + for i in 0..