Skip to content

Commit

Permalink
✨[FEAT] #146 - 스크랩한 스튜디오 수 나타내는 헤더뷰 UI 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jumining committed Jan 19, 2023
1 parent 60eb256 commit 72cde3b
Showing 1 changed file with 54 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ final class LikedStudiosViewController: UIViewController {

// MARK: - UI Properties
private let navigationBar = FilinNavigationBar()
private let headerView = UIView()

private lazy var studiosCollectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
Expand All @@ -28,6 +29,26 @@ final class LikedStudiosViewController: UIViewController {
}()

private let upButton = UIButton().then {
private let myStudioLabel = UILabel().then {
$0.text = "My Studio"
$0.font = UIFont(name: "FuturaStd-Book", size: 16)
$0.textColor = .fillinWhite
}

private let backCircleView = UIView().then {
$0.backgroundColor = .fillinRed
$0.layer.cornerRadius = 12
}

private var studioCountLabel = UILabel().then {
$0.font = UIFont(name: "FuturaStd-Book", size: 12)
$0.textColor = .fillinWhite
}

private let borderLineView = UIView().then {
$0.backgroundColor = .darkGrey1
}

$0.setImage(Asset.btnUp.image, for: .normal)
}

Expand All @@ -45,8 +66,10 @@ final class LikedStudiosViewController: UIViewController {
// MARK: - Custom Method
private func setDummyData() {
for _ in 0..<20 {
for _ in 0..<22 {
likedStudiosList.append(contentsOf: [LikedStudio(id: 0, name: "필린 사진관", address: "서울특별시 영등포구 여의도동21-3 가가가가가가가가가가가가가가가가")])
}
studioCountLabel.text = "\(likedStudiosList.count)"
}
}

Expand Down Expand Up @@ -78,23 +101,50 @@ extension LikedStudiosViewController {
extension LikedStudiosViewController {
private func setLayout() {
layoutNavigaionBar()
layoutHeaderView()
layoutStudiosCollectionView()
layoutFloatingUpButton()
}

private func layoutNavigaionBar() {
view.add(navigationBar)
view.addSubview(navigationBar)
navigationBar.snp.makeConstraints {
$0.top.equalTo(view.safeAreaLayoutGuide)
$0.leading.trailing.equalToSuperview()
$0.height.equalTo(50)
}
}

private func layoutHeaderView() {
view.addSubview(headerView)
headerView.addSubviews([myStudioLabel, backCircleView, studioCountLabel, borderLineView])
headerView.snp.makeConstraints {
$0.top.equalTo(navigationBar.snp.bottom)
$0.leading.trailing.equalToSuperview()
$0.height.equalTo(50)
}
myStudioLabel.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.leading.equalToSuperview().inset(19)
}
backCircleView.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.trailing.equalToSuperview().inset(18)
$0.width.height.equalTo(24)
}
studioCountLabel.snp.makeConstraints {
$0.center.equalTo(backCircleView)
}
borderLineView.snp.makeConstraints {
$0.leading.bottom.trailing.equalToSuperview()
$0.height.equalTo(1)
}
}

private func layoutStudiosCollectionView() {
view.add(studiosCollectionView)
view.addSubview(studiosCollectionView)
studiosCollectionView.snp.makeConstraints {
$0.top.equalTo(navigationBar.snp.bottom)
$0.top.equalTo(headerView.snp.bottom)
$0.leading.bottom.trailing.equalToSuperview()
}
}
Expand All @@ -111,10 +161,7 @@ extension LikedStudiosViewController {
// MARK: - UICollectionViewDelegate
extension LikedStudiosViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print(indexPath.row)
// let studioMapViewController = StudioMapViewController(contentViewController: <#UIViewController#>)
// detailMyDiaryViewController.diaryId = diaryList[indexPath.row].diaryId
// self.navigationController?.pushViewController(studioMapViewController, animated: true)
// TODO: - 뷰 전환
}
}

Expand Down

0 comments on commit 72cde3b

Please sign in to comment.