Skip to content

Commit

Permalink
[feat] FeedDetailTableViewCell UI 작업 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
BAEKYUJEONG committed Oct 13, 2024
1 parent 651fdb5 commit 6fbc33a
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
4 changes: 4 additions & 0 deletions PLUV.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
68DC8AAE2C3C535500A03042 /* PLUVTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68DC8AAD2C3C535500A03042 /* PLUVTests.swift */; };
68DC8AB82C3C535500A03042 /* PLUVUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68DC8AB72C3C535500A03042 /* PLUVUITests.swift */; };
68DC8ABA2C3C535500A03042 /* PLUVUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68DC8AB92C3C535500A03042 /* PLUVUITestsLaunchTests.swift */; };
68E312252CBC024D00243658 /* FeedDetailTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68E312242CBC024D00243658 /* FeedDetailTableViewCell.swift */; };
68EE372D2CB0749E0077632B /* FeedInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68EE372C2CB0749E0077632B /* FeedInfo.swift */; };
68F6FAB02C4A8ECF001128FF /* MoveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F6FAAF2C4A8ECF001128FF /* MoveView.swift */; };
68F6FAB22C4A9CCA001128FF /* WhiteButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F6FAB12C4A9CCA001128FF /* WhiteButton.swift */; };
Expand Down Expand Up @@ -173,6 +174,7 @@
68DC8AB32C3C535500A03042 /* PLUVUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PLUVUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
68DC8AB72C3C535500A03042 /* PLUVUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PLUVUITests.swift; sourceTree = "<group>"; };
68DC8AB92C3C535500A03042 /* PLUVUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PLUVUITestsLaunchTests.swift; sourceTree = "<group>"; };
68E312242CBC024D00243658 /* FeedDetailTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedDetailTableViewCell.swift; sourceTree = "<group>"; };
68EE372C2CB0749E0077632B /* FeedInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedInfo.swift; sourceTree = "<group>"; };
68F6FAAF2C4A8ECF001128FF /* MoveView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoveView.swift; sourceTree = "<group>"; };
68F6FAB12C4A9CCA001128FF /* WhiteButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhiteButton.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -239,6 +241,7 @@
68830FAE2C8264CA00995785 /* FeedViewModel.swift */,
68830FB22C8265F600995785 /* FeedCollectionViewCell.swift */,
68830FB42C8273DA00995785 /* FeedDetailViewController.swift */,
68E312242CBC024D00243658 /* FeedDetailTableViewCell.swift */,
);
path = Feed;
sourceTree = "<group>";
Expand Down Expand Up @@ -769,6 +772,7 @@
68DB03902C813EA600FBD014 /* DeleteAccountViewController.swift in Sources */,
68DB03832C80F1AB00FBD014 /* MyPageViewController.swift in Sources */,
688EFDB72C42886E0067D053 /* TransferTableViewCell.swift in Sources */,
68E312252CBC024D00243658 /* FeedDetailTableViewCell.swift in Sources */,
68DC4C772C6B6E9E006D8E97 /* SelectPlaylistCollectionViewCell.swift in Sources */,
68F6FAB22C4A9CCA001128FF /* WhiteButton.swift in Sources */,
68830FAF2C8264CA00995785 /* FeedViewModel.swift in Sources */,
Expand Down
89 changes: 89 additions & 0 deletions PLUV/Feed/FeedDetailTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//
// FeedDetailTableViewCell.swift
// PLUV
//
// Created by 백유정 on 10/1/24.
//

import UIKit
import RxSwift
import RxCocoa

final class FeedDetailTableViewCell: UITableViewCell {

static let identifier = String(describing: FeedDetailTableViewCell.self)
private let contentsView = UIView()
private let numberLabel = UILabel().then {
$0.textColor = .gray800
$0.font = .systemFont(ofSize: 15)
}
private let thumbnailImageView = UIImageView().then {
$0.contentMode = .scaleAspectFit
// $0.layer.cornerRadius = 2
$0.layer.borderColor = UIColor(white: 0, alpha: 0.1).cgColor
$0.layer.borderWidth = 0.5
$0.clipsToBounds = true
}
private let labelView = UIView()
private let songTitleLabel = UILabel().then {
$0.textColor = .gray800
$0.font = .systemFont(ofSize: 15) /// g, y, p 같은 문자 이슈로 1point 줄임
}
private let singerLabel = UILabel().then {
$0.textColor = .gray500
$0.font = .systemFont(ofSize: 13) /// g, y, p 같은 문자 이슈로 1point 줄임
}

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func prepareForReuse() {
super.prepareForReuse()
/// 셀을 재사용할 때 기본 상태로 초기화
self.contentView.backgroundColor = .white
}

override func layoutSubviews() {
setUI()
}

private func setUI() {
self.contentView.addSubview(contentsView)
contentsView.snp.makeConstraints { make in
make.leading.trailing.equalToSuperview().inset(24)
make.top.bottom.equalToSuperview().inset(8)
}

self.contentsView.addSubview(thumbnailImageView)
thumbnailImageView.snp.makeConstraints { make in
make.leading.top.bottom.equalTo(contentsView)
make.width.equalTo(thumbnailImageView.snp.height)
}

self.contentsView.addSubview(labelView)
labelView.snp.makeConstraints { make in
make.leading.equalTo(thumbnailImageView.snp.trailing).offset(12)
make.trailing.equalToSuperview().offset(-16)
make.top.bottom.equalToSuperview().inset(7)
}

self.labelView.addSubview(songTitleLabel)
songTitleLabel.snp.makeConstraints { make in
make.leading.trailing.top.equalToSuperview()
make.height.equalTo(16)
}

self.labelView.addSubview(singerLabel)
singerLabel.snp.makeConstraints { make in
make.leading.trailing.bottom.equalToSuperview()
make.height.equalTo(14)
}
}

}

0 comments on commit 6fbc33a

Please sign in to comment.