Skip to content

Commit

Permalink
Merge pull request #92 from boostcampwm-2022/feature_capsuleDetail
Browse files Browse the repository at this point in the history
캡슐 상세화면 버그 수정
  • Loading branch information
hongpower authored Dec 8, 2022
2 parents d388b57 + 4ec614e commit 405edff
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions SpaceCapsule/SpaceCapsule/Resources/FrameResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,5 @@ enum FrameResource {

static let detailSettingButtonHeight: CGFloat = 60.0
static let detailSettingButtonPadding: CGFloat = 10.0
static let detailMainStackViewHPadding: CGFloat = 30.0
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ final class CapsuleDetailView: UIView, BaseView {
collectionView.alwaysBounceHorizontal = true
collectionView.backgroundColor = .clear
collectionView.alwaysBounceHorizontal = false
collectionView.alwaysBounceVertical = false
collectionView.showsHorizontalScrollIndicator = false

return collectionView
Expand Down Expand Up @@ -116,7 +117,8 @@ final class CapsuleDetailView: UIView, BaseView {

func makeConstraints() {
mainStackView.snp.makeConstraints {
$0.edges.equalToSuperview()
$0.left.right.equalToSuperview()
$0.top.bottom.equalToSuperview().inset(FrameResource.detailMainStackViewHPadding)
}

imageCollectionView.snp.makeConstraints {
Expand All @@ -139,12 +141,17 @@ final class CapsuleDetailView: UIView, BaseView {
}

private func createLayout() -> UICollectionViewLayout {
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
heightDimension: .fractionalHeight(1))
let itemSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1),
heightDimension: .fractionalHeight(1)
)

let item = NSCollectionLayoutItem(layoutSize: itemSize)

let groupSize = NSCollectionLayoutSize(widthDimension: .absolute(FrameResource.detailImageViewWidth), heightDimension: .absolute(FrameResource.detailImageViewHeight))
let groupSize = NSCollectionLayoutSize(
widthDimension: .absolute(FrameResource.detailImageViewWidth),
heightDimension: .absolute(FrameResource.detailImageViewHeight)
)

let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ final class CapsuleDetailViewController: UIViewController, BaseViewController {
return UICollectionViewCell()
}

cell.imageView.kr.setImage(with: item.imageURL, placeholder: .empty, scale: 1.0)
cell.imageView.kr.setImage(with: item.imageURL, placeholder: .empty, scale: FrameResource.openableImageScale)

if let info = item.capsuleInfo {
cell.addCapsuleInfo(info)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ final class DetailImageCell: UICollectionViewCell {
fatalError("init(coder:) has not been implemented")
}

override func prepareForReuse() {
super.prepareForReuse()
imageView.image = nil
gradientView.removeFromSuperview()
capsuleInfoStackView.removeFromSuperview()
}

private func configure() {
contentView.layer.cornerRadius = FrameResource.commonCornerRadius
contentView.layer.masksToBounds = true
Expand Down

0 comments on commit 405edff

Please sign in to comment.