-
Notifications
You must be signed in to change notification settings - Fork 1
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
홈 화면 레이아웃 구현 (with CollectionViewFlowLayout) #51
Conversation
MHBook보다 MHBookCover가 더 명확한 것 같아 네이밍을 수정했습니다
아직 마니 미흡하네요,,
let flowLayout = UICollectionViewFlowLayout() | ||
let cellSize = (self.view.bounds.inset(by: self.view.safeAreaInsets).width - 80) / 2 | ||
flowLayout.itemSize = .init(width: cellSize, height: 210) | ||
flowLayout.minimumLineSpacing = 40 | ||
flowLayout.minimumInteritemSpacing = 20 | ||
flowLayout.sectionInset = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20) | ||
flowLayout.scrollDirection = .vertical |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MHBookCover에서도 TargetImageView를 width height로 잡았는데,
여기서도 width height로 잡는게 뭔가 레이아웃을 잘 못 잡고 있다는 생각이 드는데 이 구조가 괜찮은 건가요 ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그러면, 음 BookCover는 오토레이아웃으로 잡고 TargetImageView는 width height로 잡는 것은 어떤가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
너무너무 수고 많으셨습니당 .ᐟ.ᐟ 플로팅 버튼에 그림자 준 건 너무 좋은 것 같아요 .ᐟ.ᐟ 효카소 해야겠는데용
func prepareForReuse() { | ||
bookCoverImageView.image = nil | ||
titleLabel.text = nil | ||
targetImageView.image = nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: prepareForReuse는 UITableViewCell이나 UICollectionViewCell에서 사용되는 함수기도 하고 해당 클래스는 view인데 reuse되기 전 준비라는 메서드 명이 어색한 것 같습니다 .ᐟ.ᐟ 그냥 resetProperties와 같은 값을 초기화시킨다는 의미의 네이밍이 더 적절할 것 같다는 생각이 듭니당
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
옹 좋네요 알겠습니다 !
private let navigationBar: MHNavigationBar | ||
private let currentCategoryLabel = UILabel(style: .default) | ||
private let categorySelectButton = UIButton(type: .custom) | ||
private let bookCoverMakeFloatingButton: UIButton = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: bookCoverMake보단 makingBookFloatingButton
이 조금 더 네이밍이 적절할 것 같습니당 .. bookCoverMakeFloatingButton
이건 뭔가 책 표지만 만들겠다는 뜻 같은..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인정합니다 수정할게요
let dummyBook = [ | ||
BookCover(title: "집주인들", imageURL: "", bookColor: .pink, category: "친구", isLike: false), | ||
BookCover(title: "엄마", imageURL: "", bookColor: .blue, category: "가족", isLike: true), | ||
BookCover(title: "아빠", imageURL: "", bookColor: .green, category: "가족", isLike: true), | ||
BookCover(title: "친구", imageURL: "", bookColor: .beige, category: "가족", isLike: false), | ||
BookCover(title: "동생", imageURL: "", bookColor: .orange, category: "가족", isLike: true), | ||
BookCover(title: "집주인들", imageURL: "", bookColor: .pink, category: "친구", isLike: false), | ||
BookCover(title: "엄마", imageURL: "", bookColor: .blue, category: "가족", isLike: true), | ||
BookCover(title: "아빠", imageURL: "", bookColor: .green, category: "가족", isLike: true), | ||
BookCover(title: "친구", imageURL: "", bookColor: .beige, category: "가족", isLike: false), | ||
BookCover(title: "동생", imageURL: "", bookColor: .orange, category: "가족", isLike: true), | ||
BookCover(title: "집주인들", imageURL: "", bookColor: .pink, category: "친구", isLike: false), | ||
BookCover(title: "엄마", imageURL: "", bookColor: .blue, category: "가족", isLike: true), | ||
BookCover(title: "아빠", imageURL: "", bookColor: .green, category: "가족", isLike: true), | ||
BookCover(title: "친구", imageURL: "", bookColor: .beige, category: "가족", isLike: false), | ||
BookCover(title: "동생", imageURL: "", bookColor: .orange, category: "가족", isLike: true), | ||
BookCover(title: "집주인들", imageURL: "", bookColor: .pink, category: "친구", isLike: false), | ||
BookCover(title: "엄마", imageURL: "", bookColor: .blue, category: "가족", isLike: true), | ||
BookCover(title: "아빠", imageURL: "", bookColor: .green, category: "가족", isLike: true), | ||
BookCover(title: "친구", imageURL: "", bookColor: .beige, category: "가족", isLike: false), | ||
BookCover(title: "동생", imageURL: "", bookColor: .orange, category: "가족", isLike: true) | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: dummy data는 실제 develop 브랜치에는 드러가기 전에 빼야할 것 같습니당 .ᐟ.ᐟ
public override func viewWillAppear(_ animated: Bool) { | ||
super.viewWillAppear(animated) | ||
|
||
navigationController?.navigationBar.isHidden = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: 옹 해당 로직이 viewDidLoad에 있으면 혹시 실행되지 않나용??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
왠지 홈뷰가 왔다 갔다 할일이 많아서 여기에 하신 것같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞습니당 책 만들고 다시 돌아오면 다시 네비게이션 바가 생겨있어서
viewWillAppear에 두었습니다
self.navigationController?.pushViewController(BookCreationViewController(), animated: true) | ||
}, for: .touchUpInside) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3;
self.navigationController?.pushViewController(BookCreationViewController(), animated: true) | |
}, for: .touchUpInside) | |
let bookCreationViewController = BookCreationViewController() | |
self.navigationController?.pushViewController(bookCreationViewController, animated: true) | |
}, for: .touchUpInside) |
이렇게 한 번 변수로 선언해주는 것도 좋을 것 같아요 ! (물론 나중에 BookCreationViewModel이 생기면 바뀌긴 하겠네용..)
BookCover(title: "친구", imageURL: "", bookColor: .beige, category: "가족", isLike: false), | ||
BookCover(title: "동생", imageURL: "", bookColor: .orange, category: "가족", isLike: true) | ||
] | ||
let houseName: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: 해당 변수는 private 처리해줘야할 것 같습니다 .ᐟ.ᐟ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
국굳입니당
ᕦ(ò_óˇ)ᕤ
let flowLayout = UICollectionViewFlowLayout() | ||
let cellSize = (self.view.bounds.inset(by: self.view.safeAreaInsets).width - 80) / 2 | ||
flowLayout.itemSize = .init(width: cellSize, height: 210) | ||
flowLayout.minimumLineSpacing = 40 | ||
flowLayout.minimumInteritemSpacing = 20 | ||
flowLayout.sectionInset = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20) | ||
flowLayout.scrollDirection = .vertical |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그러면, 음 BookCover는 오토레이아웃으로 잡고 TargetImageView는 width height로 잡는 것은 어떤가요?
MemorialHouse/MHPresentation/MHPresentation/Source/Home/HomeViewController.swift
Outdated
Show resolved
Hide resolved
public override func viewWillAppear(_ animated: Bool) { | ||
super.viewWillAppear(animated) | ||
|
||
navigationController?.navigationBar.isHidden = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
왠지 홈뷰가 왔다 갔다 할일이 많아서 여기에 하신 것같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 ~~
let cellSize = (self.view.bounds.inset(by: self.view.safeAreaInsets).width - 80) / 2 | ||
flowLayout.itemSize = .init(width: cellSize, height: 210) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3
cellSize 대신 cellWidth는 어떨지 조심스럽게 제안드립니다.
hegiht에 대한 부분도 변수로 하면 일관성이 있을 거 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인정합니당 수정할게요 !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
효준님 추가로 이미지를 봤을 때 책 하단에 더보기 버튼(...) 이게 먼가 비율이.. 피그마랑 살짝 다른 것 같아서 이것 한 번 봐주시면 너무너무 감사드리겠습니당 🙇🏻♀️🙇🏻♀️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
너무 공생 많으셨읍니다!! 오늘도 화이팅,,
╰(´︶`)╯♡
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HomeViewModel의 리뷰들이 아직 반영되지 않은 것 같습니다 .ᐟ.ᐟ 일단 Approve는 드렸는데, 해당 파일 리뷰 확인해주시고 반영해주신 후에 Merge해주시면 감사하겠습니다 .ᐟ.ᐟ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
열정맨 ~ 고생많으셨습니다 !!!
#️⃣ 연관된 이슈
📝 작업 내용
추억 만들기
버튼 생성⏰ 작업시간
📒 리뷰 노트
추억 만들기
버튼에 임의로 쉐도우를 넣었는데 어떤가요 ..??있는 버전
없는 버전
⚽️ 트러블 슈팅
문제 상황
버튼에 레이아웃을 아무리 건드려도 버튼 안에 들어있는 이미지는 늘어나지 않는다..!
버튼 안에 있는 이미지 사이즈 조절하는 방법
문제 해결
개요
현재 코드는 이렇게 버튼에만 레이아웃이 걸려있다.
위 문제를 해결하기 위해 구글링 한 결과 4가지 정도 알아냈다.
일단, 1번과 2번은 UIButtonConfiguration이 나오고부터 deprecated 됐다.
지금 블로그에 나와있는 건 대부분 deprecated 된 메소드를 쓰고 있음 ㅠ
탈락.
3번으로 할 수 있긴 한데, 언젠가 또 필요한 순간이 올 거 같아서 4번으로 결정했다.
구현 과정
먼저 UIImage에 확장으로 image와 size를 받는 메소드를 만든다.
그리고 ImageRenderer를 통해 이미지를 새로 그릴 건데,
이때 사이즈를 입력받아서 내가 넣은 이미지가 해당 사이즈로 리턴되게 구현했다.
그러면 위와같이 사용할 수 있다 !
📸 스크린샷 & 영상
영상
스크린샷