Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] #15 - GoalRewardInfoVC UI 구현 #17

Merged

Conversation

dlwogus0128
Copy link
Contributor

🌱 작업한 내용

  • GoalRewardInfoVC UI 구현

🌱 PR Point

  • 뭔가.. 콜렉션뷰 부분에서 맨 아래로 내렸을 때 맨 아랫줄 도장까지 보이게 하고 싶은데??
    (몬말인지 아시겠나요??) 어떻게 할까욥

📸 스크린샷

구현 내용 스크린샷
목표 보상 화면

📮 관련 이슈

@dlwogus0128 dlwogus0128 self-assigned this Jan 2, 2023
@dlwogus0128 dlwogus0128 added Feat 새로운 기능 구현 재현🐶 labels Jan 2, 2023
Copy link
Collaborator

@lsj8706 lsj8706 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고민을 많이 해본 흔적이 보이네요!! 좋습니다~! 금방 고수가 될 거 같아요 👍👍
달아준 리뷰들 한번 반영해보고 잘 모르겠으면 언제든 연락주세요~!


// MARK: - GoalRewardInfoCVC

class GoalRewardInfoCVC: UICollectionViewCell {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final~!


// MARK: - Identifier

static let identifier = "GoalRewardInfoCVC"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 이번에 추가한 utils중에 className을 사용하면 필요없어요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 44 to 66
// MARK: - Variables

var stampList: [GoalRewardInfoModel] = [
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampC1, stampStandard: "그리기 스타터"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampC2, stampStandard: "그리기 중수"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampC3, stampStandard: "그리기 마스터"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampS1, stampStandard: "스크랩 베이비"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampS2, stampStandard: "스크랩 어린이"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampS3, stampStandard: "스크랩 어른이"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampP1, stampStandard: "새싹 업로더"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampP2, stampStandard: "중수 업로더"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampP3, stampStandard: "인플루언서"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampR1, stampStandard: "달리기 유망주"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampR2, stampStandard: "아마추어 선수"),
GoalRewardInfoModel(stampImg: ImageLiterals.imgStampR2, stampStandard: "마라톤 선수")
]

// MARK: - Constants

final let stampInset: UIEdgeInsets = UIEdgeInsets(top: 32, left: 34, bottom: 10, right: 34)
final let stampLineSpacing: CGFloat = 20
final let stampItemSpacing: CGFloat = 26
final let stampCellHeight: CGFloat = 112
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이부분은 위에 UI Components 보다 위쪽에 위치하도록 하면 좋아요~!

}

// MARK: - Methods
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사용하지 않은 주석들은 지워줍시다~!

Comment on lines 128 to 139
stampBottomView.snp.makeConstraints { make in
make.top.equalTo(stampTopView.snp.bottom)
make.leading.trailing.equalTo(view.safeAreaLayoutGuide)
make.height.equalTo(view.safeAreaLayoutGuide).inset(80)
}

stampBottomView.addSubview(stampCollectionView)

stampCollectionView.snp.makeConstraints { make in
make.top.leading.trailing.equalToSuperview()
make.height.equalTo(calculateCellHeight())
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금 보면 콜렉션 뷰를 stampBottomView로 감싸주고 있는데 그럴 필요 없어요!
모든 뷰를 감쌀 필요는 없습니다~!
저였으면 바로

stampCollectionView.snp.makContraints { make in 
    make.top.equalTo(stampTopView.snp.bottom)
    make.leading.trailing.equalTo(view. safeAreaLayoutGuide)
    make.bottom.equalToSuperView()
}

콜렉션뷰에 레이아웃을 잡았을 거 같아요!! 그리고 콜렉션 뷰에서 calculateCellHeight()로 높이를 직접 구해서 넣어줄 필요 없어요!
오토 레이아웃만 제가 제시한 코드대로 잘 잡아주면 알아서 높이가 잘 잡힐거에요~!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헐!

extension GoalRewardInfoVC: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let screenWidth = UIScreen.main.bounds.width
let tripleCellWidth = screenWidth - stampInset.left - stampInset.right - stampItemSpacing * 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


private func register() {
stampCollectionView.register(GoalRewardInfoCVC.self,
forCellWithReuseIdentifier: GoalRewardInfoCVC.identifier)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
forCellWithReuseIdentifier: GoalRewardInfoCVC.identifier)
forCellWithReuseIdentifier: GoalRewardInfoCVC.className)

으로 사용하면 identifier를 만들어줄 필요가 없어요

@dlwogus0128 dlwogus0128 merged commit f752460 into Runnect:develop Jan 3, 2023
@dlwogus0128 dlwogus0128 deleted the feat/#15-GoalRewardInfoVC-UI-구현 branch January 3, 2023 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feat 새로운 기능 구현 재현🐶
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feat] GoalRewardInfoVC UI 구현
2 participants