FavorButton height #29
nomatterjun
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
이런식으로 말하는걸까? import UIKit
import SnapKit
final class LargeFavorButton: UIButton {
enum Style {
case black
case white
}
// MARK: - Initializer
init(with style: Style, title: String) {
super.init(frame: .zero)
setupConfiguration(with: style, title: title)
setupHeight()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - Setup
private func setupConfiguration(with style: Style, title: String) {
var config = UIButton.Configuration.filled()
var container = AttributeContainer()
container.font = .favorFont(.bold, size: 18)
config.background.cornerRadius = 28
switch style {
case .white:
container.foregroundColor = .favorColor(.typo)
config.baseBackgroundColor = .favorColor(.box1)
case .black:
container.foregroundColor = .favorColor(.white)
config.baseBackgroundColor = .favorColor(.typo)
}
config.attributedTitle = AttributedString(title, attributes: container)
self.configuration = config
}
private func setupHeight() {
self.snp.makeConstraints { make in
make.height.equalTo(56)
}
}
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
FavorButton
을 지금 자세히 보니깐 기본 높이가 없더라고..!디자인 보면
LargeFavorButton
은 56픽셀,SmallFavorButton
은 32픽셀로다 동일한 것 같아서 기본 높이를 주는 건 어때?
Beta Was this translation helpful? Give feedback.
All reactions