-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: 재생화면 뷰 구현(UI) #29
Changes from 7 commits
46651f0
fe16f2a
b951fb8
02536ba
120165b
93af59f
60481eb
588ed4a
898f559
12bdc6a
5f968b6
c6ea93f
b3691c4
97739e3
1e3ef7c
6881b68
9e7719f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// | ||
// LODescriptionView.swift | ||
// Layover | ||
// | ||
// Created by 황지웅 on 11/15/23. | ||
// | ||
|
||
import UIKit | ||
|
||
final class LODescriptionView: UIView { | ||
static let descriptionWidth: CGFloat = 104 | ||
static let descriptionHeight: CGFloat = 63 | ||
|
||
// MARK: - View isTouched State | ||
|
||
enum State { | ||
case show | ||
case hidden | ||
} | ||
|
||
// MARK: - Properties | ||
|
||
private (set) var titleLabel: UILabel = { | ||
let label: UILabel = UILabel() | ||
label.numberOfLines = 1 | ||
label.font = .loFont(type: .body1) | ||
label.textColor = .layoverWhite | ||
label.text = "제목 테스트" | ||
return label | ||
}() | ||
private (set) var descriptionLabel: UILabel = { | ||
let label: UILabel = UILabel() | ||
label.textColor = .layoverWhite | ||
label.font = .loFont(type: .body2) | ||
label.numberOfLines = 0 | ||
return label | ||
}() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 혹시 라벨을 var로 선언하신 이유가 있을까요 ?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ready only로 쓰려고 private (set) var를 했는데 이렇게 쓸거면 private 풀고 let 박아두는게 나을거 같아서 수정했습니다 감사합니다. |
||
private var descrioptionText: String = "" | ||
var state: State = .hidden | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
setupConstraints() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
super.init(coder: coder) | ||
setupConstraints() | ||
} | ||
|
||
// MARK: Method | ||
|
||
private func setupConstraints() { | ||
descriptionLabel.textColor = .layoverWhite | ||
descriptionLabel.font = .loFont(type: .body2) | ||
descriptionLabel.numberOfLines = 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 아차차... 감사합니다. |
||
descriptionLabel.translatesAutoresizingMaskIntoConstraints = false | ||
titleLabel.translatesAutoresizingMaskIntoConstraints = false | ||
self.addSubviews(descriptionLabel, titleLabel) | ||
|
||
NSLayoutConstraint.activate([ | ||
titleLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor), | ||
titleLabel.bottomAnchor.constraint(equalTo: descriptionLabel.topAnchor), | ||
descriptionLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor), | ||
descriptionLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor), | ||
descriptionLabel.widthAnchor.constraint(equalTo: self.widthAnchor) | ||
]) | ||
} | ||
|
||
func setText(_ content: String) { | ||
let attrString: NSMutableAttributedString = NSMutableAttributedString(string: content) | ||
let paragraphStyle = NSMutableParagraphStyle() | ||
paragraphStyle.lineHeightMultiple = 1.3 | ||
attrString.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attrString.length)) | ||
descriptionLabel.attributedText = attrString | ||
} | ||
|
||
func checkLabelOverflow() -> Bool { | ||
let originViewSize: CGSize = CGSize(width: LODescriptionView.descriptionWidth, height: LODescriptionView.descriptionHeight) | ||
let currentSize: CGSize = descriptionLabel.intrinsicContentSize | ||
return currentSize.height > originViewSize.height || currentSize.width > originViewSize.width | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// LOSlider.swift | ||
// Layover | ||
// | ||
// Created by 황지웅 on 11/15/23. | ||
// | ||
|
||
import UIKit | ||
|
||
final class LOSlider: UISlider { | ||
private let normalThumbImage: String = "LONormalThumb" | ||
private let selectedThumbImage: String = "LOSelectedThumb" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. UISlider에 thumb는 UIImage로 밖에 못 넣는거 같아서.. 좀 더 확인해보겠습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resource loader 사용하시면 될 듯 해서 없어도 될 코드 인 것 같습니다. |
||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
self.minimumTrackTintColor = .primaryPurple | ||
setThumbImage(UIImage(named: normalThumbImage), for: .normal) | ||
self.minimumValue = 1 | ||
self.maximumValue = 100 | ||
self.value = 50 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 일단 레이아웃 뷰 배치만 하려고 임시로 설정했습니다. |
||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 코드 연쇄살인마를 위해 fatalError외에 구현해주세요... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오마오마갓 |
||
|
||
override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { | ||
setThumbImage(UIImage(named: selectedThumbImage), for: .normal) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setThumbImage(UIImage.selectedThumbImage, for: .normal |
||
return true | ||
} | ||
|
||
override func endTracking(_ touch: UITouch?, with event: UIEvent?) { | ||
setThumbImage(UIImage(named: normalThumbImage), for: .normal) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// LOTagStackView.swift | ||
// Layover | ||
// | ||
// Created by 황지웅 on 11/16/23. | ||
// Copyright © 2023 CodeBomber. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
final class LOTagStackView: UIStackView { | ||
lazy var tagButton1: UIButton = setButton("#테스트1") | ||
lazy var tagButton2: UIButton = setButton("#테스트2") | ||
lazy var tagButton3: UIButton = setButton("#테스트3") | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
setUpConstraints() | ||
} | ||
|
||
required init(coder: NSCoder) { | ||
super.init(coder: coder) | ||
setUpConstraints() | ||
} | ||
|
||
private func setUpConstraints() { | ||
[tagButton1, tagButton2, tagButton3].forEach { tagButton in | ||
self.addArrangedSubview(tagButton) | ||
} | ||
self.alignment = .fill | ||
self.distribution = .fillProportionally | ||
self.axis = .horizontal | ||
self.spacing = 8 | ||
} | ||
|
||
private func setButton(_ content: String) -> UIButton { | ||
let button: UIButton = UIButton() | ||
var config = UIButton.Configuration.plain() | ||
config.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in | ||
var outgoing = incoming | ||
outgoing.font = UIFont.loFont(type: .body2Bold) | ||
return outgoing | ||
} | ||
Comment on lines
+38
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
button.backgroundColor = UIColor.primaryPurple | ||
button.setTitleColor(UIColor.layoverWhite, for: .normal) | ||
button.setTitle(content, for: .normal) | ||
button.configuration = config | ||
button.configuration?.contentInsets = NSDirectionalEdgeInsets(top: 5.0, leading: 8.0, bottom: 5.0, trailing: 8.0) | ||
button.layer.cornerRadius = 12 | ||
return button | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Ellipse 46.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "Ellipse 47.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "Ellipse 48.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "big.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "big 1.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "big 2.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
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.
가능하면 mark 주석 부탁드립니다~