Skip to content

Commit

Permalink
[fix] 피드 디테일 곡의 개수에 따라 스크롤뷰의 높이가 달라지는 레이아웃 변경 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaewift committed Nov 26, 2024
1 parent fc50417 commit fd84f11
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions PLUV/Feed/FeedDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class FeedDetailViewController: UIViewController, SaveMoveViewFeedDelegate {
self.navigationController?.setNavigationBarHidden(true, animated: false)

scrollView.showsVerticalScrollIndicator = false
scrollView.isScrollEnabled = false

self.view.addSubview(scrollView)
scrollView.snp.makeConstraints { make in
Expand Down Expand Up @@ -173,15 +174,14 @@ class FeedDetailViewController: UIViewController, SaveMoveViewFeedDelegate {
}

private func setTableViewHeight() {
feedDetailTableView.layoutIfNeeded()

let contentHeight = feedDetailTableView.contentSize.height
feedDetailTableViewHeightConstraint?.update(offset: contentHeight + 100)
let contentHeight = feedDetailTableView.contentSize.height + 110
feedDetailTableViewHeightConstraint?.update(offset: contentHeight)

/// 이미지 높이 + 테이블 뷰 높이를 합산하여 스크롤뷰의 contentSize 설정
let totalHeight = navigationbarView.frame.height + feedDetailImageView.frame.height + feedDetailTitleView.frame.height + contentHeight
scrollView.contentSize = CGSize(width: view.frame.width, height: totalHeight)
scrollView.layoutIfNeeded()
scrollView.isScrollEnabled = true
}

private func setPlaylistData() {
Expand All @@ -208,7 +208,6 @@ class FeedDetailViewController: UIViewController, SaveMoveViewFeedDelegate {
case 200:
self.viewModel.selectFeedMusicItem.accept(response.data)
self.setData()
self.view.layoutIfNeeded()
default:
AlertController(message: response.msg).show()
}
Expand All @@ -226,6 +225,9 @@ class FeedDetailViewController: UIViewController, SaveMoveViewFeedDelegate {
cell.prepare(music: music, index: index)
}
.disposed(by: disposeBag)

self.feedDetailTableView.reloadData()
self.feedDetailTableView.layoutIfNeeded()
}

func setFeedSaveAPI() {
Expand Down

0 comments on commit fd84f11

Please sign in to comment.