Skip to content

Commit 557a785

Browse files
committed
Fix: 기존 등록한 이미지 제거후 다시 addSubview 하는 로직으로 변경
1 parent 14ecdf6 commit 557a785

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

HomeCafeRecipes/HomeCafeRecipes/Presentation/Feed/View/RecipeDetailView.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,18 @@ final class RecipeDetailView: UIView {
109109
}
110110

111111
private func setupScrollViewContent(with recipeImageUrls: [URL]) {
112-
guard !imagesAdded else { return }
112+
scrollView.subviews.forEach { $0.removeFromSuperview() }
113+
113114
let imageViewWidth = UIScreen.main.bounds.width
114115

115116
recipeImageUrls.enumerated().forEach { index, url in
116117
let imageView = UIImageView()
117118
imageView.kf.setImage(with: url)
118119
imageView.contentMode = .scaleAspectFill
119120

120-
121121
let xPos = CGFloat(index) * imageViewWidth
122122
imageView.frame = CGRect(x: xPos, y: 0, width: imageViewWidth, height: 200)
123123
scrollView.addSubview(imageView)
124-
imagesAdded = true
125124
}
126125

127126
let contentWidth = imageViewWidth * CGFloat(recipeImageUrls.count)

0 commit comments

Comments
 (0)