Skip to content

Commit

Permalink
#86 Feat: 테이스팅 노트 확인 전체 UI 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinLee02 committed Oct 30, 2024
1 parent fe95fe0 commit ac37dac
Show file tree
Hide file tree
Showing 4 changed files with 282 additions and 10 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion Drink-EG/Drink-EG/Resources/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// 화면을 구성하는 UIWindow 인스턴스 생성
let window = UIWindow(windowScene: windowScene)
// 실제 첫 화면이 되는 MainViewController 인스턴스 생성
let vc = ClassSelectionViewController()
let vc = RatingWineViewController()
// NavigationController을 사용할 경우, MainViewController를 rootViewController로 갖는 NavigationController을 생성해야한다.
let navigationController = UINavigationController(rootViewController: vc)
navigationController.isNavigationBarHidden = true
Expand Down
273 changes: 268 additions & 5 deletions Drink-EG/Drink-EG/Sources/Cells/TastingNote/WineInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
//

import UIKit
import SnapKit
import Cosmos

class WineInfoView: UIView {

private let wineName: UILabel = {
let w = UILabel()
w.text = "루이 로드레 크리스탈 2015"
Expand Down Expand Up @@ -70,10 +72,147 @@ class WineInfoView: UIView {
private let graphLabel: UILabel = {
let g = UILabel()
g.text = "Graph"
g.font = UIFont.
}
g.font = UIFont.ptdBoldFont(ofSize: 14)
g.textColor = .black
return g
}()

private let graphVector: UIView = {
let v = UIView()
v.backgroundColor = UIColor(hex: "#B06FCD")
return v
}()

private let polygonView: UIView = {
let v = UIView()
v.backgroundColor = .lightGray
return v
}()

private let rateLabel: UILabel = {
let r = UILabel()
r.text = "Rate"
r.font = UIFont.ptdBoldFont(ofSize: 14)
return r
}()

private let rateVector: UIView = {
let r = UIView()
r.backgroundColor = UIColor(hex: "#DBDBDB")
return r
}()

private let ratingButton: CosmosView = {
let r = CosmosView()
r.rating = 2.5
r.settings.fillMode = .half
r.settings.emptyBorderColor = .clear
r.settings.starSize = 20
r.settings.starMargin = 5
r.settings.filledColor = UIColor(hex: "#7E13B1")!
r.settings.emptyColor = UIColor(hex: "D9D9D9")!
return r
}()

private let ratingLabel: UILabel = {
let ratingValue: Double = 2.5
let r = UILabel()
r.text = "\(ratingValue) / 5.0"
r.textColor = UIColor(hex: "#999999")
return r
}()

private let tastingNoteLabel: UILabel = {
let t = UILabel()
t.text = "Tasting Notes"
t.font = UIFont.ptdBoldFont(ofSize: 14)
t.textColor = .black
return t
}()

private let tastingNoteVector: UIView = {
let t = UIView()
t.backgroundColor = UIColor(hex: "#DBDBDB")
return t
}()

private let aromaLabel: UILabel = {
let a = UILabel()
a.text = "Aroma"
a.textColor = .black
a.font = UIFont.ptdSemiBoldFont(ofSize: 13)
a.textAlignment = .center
return a
}()

private let aromaDescriptionLabel: UILabel = {
let a = UILabel()
a.text = "API"
a.textColor = .black
a.font = UIFont.ptdSemiBoldFont(ofSize: 11)
a.textAlignment = .center
return a
}()

private let tasteLabel: UILabel = {
let a = UILabel()
a.text = "Taste"
a.textColor = .black
a.font = UIFont.ptdSemiBoldFont(ofSize: 13)
a.textAlignment = .center
return a
}()

private let tasteDescriptionLabel: UILabel = {
let a = UILabel()
a.text = "API"
a.textColor = .black
a.font = UIFont.ptdSemiBoldFont(ofSize: 11)
a.textAlignment = .center
return a
}()

private let finishLabel: UILabel = {
let a = UILabel()
a.text = "Finish"
a.textColor = .black
a.font = UIFont.ptdSemiBoldFont(ofSize: 13)
a.textAlignment = .center
return a
}()

private let finishDescriptionLabel: UILabel = {
let a = UILabel()
a.text = "API"
a.textColor = .black
a.font = UIFont.ptdSemiBoldFont(ofSize: 11)
a.textAlignment = .center
return a
}()

private let reviewLabel: UILabel = {
let r = UILabel()
r.text = "Review"
r.textColor = .black
r.font = UIFont.ptdSemiBoldFont(ofSize: 14)
r.textAlignment = .center
return r
}()

private let reviewVector: UIView = {
let r = UIView()
r.backgroundColor = UIColor(hex: "DBDBDB")
return r
}()

private let reviewDescription: UILabel = {
let r = UILabel()
r.text = "API"
r.textColor = .black
r.font = UIFont.ptdMediumFont(ofSize: 11)
r.textAlignment = .center
return r
}()

func setupUI() {
addSubview(wineName)
Expand Down Expand Up @@ -114,10 +253,134 @@ class WineInfoView: UIView {
make.top.equalTo(wineGrape.snp.bottom).offset(8)
make.leading.equalTo(wineGrape.snp.leading)
}

addSubview(graphView)
graphView.snp.makeConstraints { make in
make.top.equalTo(wineDescription.snp.bottom).offset(24)
make.leading.equalTo(wineImage.snp.leading)
make.centerX.equalToSuperview()
make.height.greaterThanOrEqualTo(747)
}

graphView.addSubview(graphLabel)
graphLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16)
make.leading.equalToSuperview().offset(24)
}

graphView.addSubview(graphVector)
graphVector.snp.makeConstraints { make in
make.top.equalTo(graphLabel.snp.bottom).offset(6)
make.leading.equalTo(graphLabel.snp.leading).offset(-4)
make.height.equalTo(1)
make.centerX.equalToSuperview()
}

graphView.addSubview(polygonView)
polygonView.snp.makeConstraints { make in
make.top.equalTo(graphVector.snp.bottom).offset(26)
make.leading.equalTo(graphVector.snp.leading)
make.centerX.equalTo(graphVector.snp.centerX)
make.height.greaterThanOrEqualTo(270)
}

graphView.addSubview(rateLabel)
rateLabel.snp.makeConstraints { make in
make.top.equalTo(polygonView.snp.bottom).offset(40)
make.leading.equalTo(graphLabel)
}

graphView.addSubview(rateVector)
rateVector.snp.makeConstraints { make in
make.top.equalTo(rateLabel.snp.bottom).offset(6.06)
make.leading.trailing.equalTo(graphVector)
make.height.equalTo(1)
}

graphView.addSubview(ratingLabel)
ratingLabel.snp.makeConstraints { make in
make.leading.equalTo(rateVector.snp.leading).offset(6.5)
make.top.equalTo(rateVector.snp.bottom).offset(11)
}

graphView.addSubview(ratingButton)
ratingButton.snp.makeConstraints { make in
make.top.equalTo(ratingLabel.snp.top)
make.leading.equalTo(ratingLabel.snp.trailing).offset(11.5)
make.width.greaterThanOrEqualTo(114)
make.height.greaterThanOrEqualTo(21)
}

graphView.addSubview(tastingNoteLabel)
tastingNoteLabel.snp.makeConstraints { make in
make.top.equalTo(ratingLabel).offset(38)
make.leading.equalTo(ratingLabel.snp.leading)
}

graphView.addSubview(tastingNoteVector)
tastingNoteVector.snp.makeConstraints { make in
make.top.equalTo(tastingNoteLabel.snp.bottom).offset(6.06)
make.leading.trailing.equalTo(rateVector)
make.height.equalTo(1)
}

graphView.addSubview(aromaLabel)
aromaLabel.snp.makeConstraints { make in
make.top.equalTo(tastingNoteVector.snp.bottom).offset(12)
make.leading.equalTo(tastingNoteVector.snp.leading).offset(7.94)
}

graphView.addSubview(aromaDescriptionLabel)
aromaDescriptionLabel.snp.makeConstraints { make in
make.centerY.equalTo(aromaLabel.snp.centerY)
make.leading.equalTo(aromaLabel.snp.trailing).offset(19.17)
}

graphView.addSubview(tasteLabel)
tasteLabel.snp.makeConstraints { make in
make.top.equalTo(aromaLabel.snp.bottom).offset(19)
make.leading.equalTo(aromaLabel.snp.leading)
}

graphView.addSubview(tasteDescriptionLabel)
tasteDescriptionLabel.snp.makeConstraints { make in
make.centerY.equalTo(tasteLabel.snp.centerY)
make.leading.equalTo(aromaDescriptionLabel.snp.leading)
}

graphView.addSubview(finishLabel)
finishLabel.snp.makeConstraints { make in
make.top.equalTo(tasteLabel.snp.bottom).offset(19)
make.leading.equalTo(tasteLabel.snp.leading)
}

graphView.addSubview(finishDescriptionLabel)
finishDescriptionLabel.snp.makeConstraints { make in
make.centerY.equalTo(finishLabel.snp.centerY)
make.leading.equalTo(tasteDescriptionLabel.snp.leading)
}

graphView.addSubview(reviewLabel)
reviewLabel.snp.makeConstraints { make in
make.top.equalTo(finishLabel).offset(33)
make.leading.equalTo(tastingNoteLabel)
}

graphView.addSubview(reviewVector)
reviewVector.snp.makeConstraints { make in
make.top.equalTo(reviewLabel.snp.bottom).offset(6.06)
make.leading.trailing.equalTo(tastingNoteVector)
make.height.equalTo(1)
}

graphView.addSubview(reviewDescription)
reviewDescription.snp.makeConstraints { make in
make.top.equalTo(reviewVector.snp.bottom).offset(22)
make.leading.equalTo(reviewVector.snp.leading).offset(8.56)
}

}



override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .clear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,27 @@ import UIKit
class RatingWineViewController: UIViewController {

let wineView = WineInfoView()

let scrollView = UIScrollView()
override func viewDidLoad() {
super.viewDidLoad()

setupUI()
}

func setupUI() {
view.addSubview(wineView)
view.backgroundColor = UIColor(hex: "#F8F8FA")

view.addSubview(scrollView)
view.backgroundColor = UIColor(hex: "F8F8FA")
scrollView.snp.makeConstraints { make in
make.edges.equalTo(view.safeAreaLayoutGuide)
}

scrollView.addSubview(wineView)
wineView.backgroundColor = UIColor(hex: "F8F8FA")
wineView.snp.makeConstraints { make in
make.edges.equalToSuperview()
make.edges.equalTo(scrollView)
make.width.equalTo(scrollView)
make.height.equalTo(1000)
}
}

Expand Down

0 comments on commit ac37dac

Please sign in to comment.