fix(album): prevent black screen when switching preview variants
This commit is contained in:
@@ -639,11 +639,6 @@ private final class TravelAlbumPreviewImageCell: UICollectionViewCell, UIScrollV
|
||||
resetZoom()
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
imageView.frame = scrollView.bounds
|
||||
}
|
||||
|
||||
func apply(asset newAsset: TravelAlbumPreviewAsset?) {
|
||||
asset = newAsset
|
||||
resetZoom()
|
||||
@@ -687,6 +682,7 @@ private final class TravelAlbumPreviewImageCell: UICollectionViewCell, UIScrollV
|
||||
imageView.contentMode = .scaleAspectFit
|
||||
imageView.backgroundColor = .black
|
||||
imageView.kf.indicatorType = .activity
|
||||
imageView.accessibilityIdentifier = "travelAlbum.previewImageView"
|
||||
|
||||
retryButton.setTitle("图片加载失败,点击重试", for: .normal)
|
||||
retryButton.setTitleColor(UIColor.white.withAlphaComponent(0.82), for: .normal)
|
||||
@@ -699,6 +695,11 @@ private final class TravelAlbumPreviewImageCell: UICollectionViewCell, UIScrollV
|
||||
scrollView.addSubview(imageView)
|
||||
contentView.addSubview(retryButton)
|
||||
scrollView.snp.makeConstraints { $0.edges.equalToSuperview() }
|
||||
imageView.snp.makeConstraints { make in
|
||||
make.edges.equalTo(scrollView.contentLayoutGuide)
|
||||
make.width.equalTo(scrollView.frameLayoutGuide)
|
||||
make.height.equalTo(scrollView.frameLayoutGuide)
|
||||
}
|
||||
retryButton.snp.makeConstraints { $0.center.equalToSuperview() }
|
||||
|
||||
let singleTap = UITapGestureRecognizer(target: self, action: #selector(singleTapped))
|
||||
|
||||
Reference in New Issue
Block a user