From 8af7bb75513da4e68ae45af242ec5f5412635dea Mon Sep 17 00:00:00 2001 From: kpk0616 Date: Sat, 14 Jan 2023 02:21:42 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20#46=20-=20=EC=A0=80=EC=9E=A5,=20?= =?UTF-8?q?=EC=83=81=EC=84=B8,=20=EA=B2=80=EC=83=89=20=EB=B7=B0=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContentDetailViewController.swift | 2 ++ .../Views/HomeSearchCollectionViewCell.swift | 26 +++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Keyneez/Keyneez/Tab/Home/Controllers/ContentDetailViewController.swift b/Keyneez/Keyneez/Tab/Home/Controllers/ContentDetailViewController.swift index fb82f77..7f139c6 100644 --- a/Keyneez/Keyneez/Tab/Home/Controllers/ContentDetailViewController.swift +++ b/Keyneez/Keyneez/Tab/Home/Controllers/ContentDetailViewController.swift @@ -216,6 +216,8 @@ extension ContentDetailViewController { benefitLabel.setLineSpacing(spacing: 8) usageLabel.setLineSpacing(spacing: 8) setLikeButton(isLiked: model.liked) + guard let url = model.contentImg else { return } + contentImageView.setImage(url: url) } } diff --git a/Keyneez/Keyneez/Tab/Home/Views/HomeSearchCollectionViewCell.swift b/Keyneez/Keyneez/Tab/Home/Views/HomeSearchCollectionViewCell.swift index 606ba94..2da9325 100644 --- a/Keyneez/Keyneez/Tab/Home/Views/HomeSearchCollectionViewCell.swift +++ b/Keyneez/Keyneez/Tab/Home/Views/HomeSearchCollectionViewCell.swift @@ -15,7 +15,14 @@ final class HomeSearchCollectionViewCell: UICollectionViewCell { let repository: ContentRepository = KeyneezContentRepository() var searchContentId: Int = -1 - private let backgroundImageView: UIImageView = .init() + private let backgroundImageView: UIImageView = .init().then { + $0.layer.cornerRadius = 4 + } + private let opacityView: UIView = .init().then { + $0.backgroundColor = .gray900 + $0.layer.opacity = 0.2 + $0.layer.cornerRadius = 4 + } private let dateLabel: UILabel = .init().then { $0.font = .font(.pretendardSemiBold, ofSize: 14) $0.textColor = .gray050 @@ -44,9 +51,16 @@ final class HomeSearchCollectionViewCell: UICollectionViewCell { extension HomeSearchCollectionViewCell { private func setLayout() { - contentView.backgroundColor = .gray900 + contentView.addSubviews(backgroundImageView) contentView.layer.cornerRadius = 4 - contentView.addSubviews(dateLabel, titleLabel, likeButton) + backgroundImageView.layer.cornerRadius = 4 + backgroundImageView.snp.makeConstraints { + $0.top.leading.trailing.bottom.equalToSuperview() + } + backgroundImageView.addSubviews(opacityView, dateLabel, titleLabel, likeButton) + opacityView.snp.makeConstraints { + $0.top.leading.trailing.bottom.equalToSuperview() + } dateLabel.snp.makeConstraints { $0.top.equalToSuperview().inset(19) $0.centerX.equalToSuperview() @@ -65,14 +79,16 @@ extension HomeSearchCollectionViewCell { dateLabel.text = setDateLabel(startAt: model.startAt, endAt: model.endAt) searchContentId = model.contentKey likeButton.isSelected = model.liked - guard let url = URL(string: model.contentImg ?? "") else { return } + guard let url = model.contentImg else { return } + backgroundImageView.setImage(url: url) // TODO: 이미지, 버튼 값 변경 } func bindLikedContentData(model: MyLikedContentResponseDto) { titleLabel.text = model.contentTitle dateLabel.text = setDateLabel(startAt: model.startAt, endAt: model.endAt) likeButton.isHidden = true - guard let url = URL(string: model.contentImg ?? "") else { return } + guard let url = model.contentImg else { return } + backgroundImageView.setImage(url: url) // TODO: 이미지, 버튼 값 변경 } @objc