Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
refactor: WTitleLabel lineheight ๊ฐœ์„  #82
Browse files Browse the repository at this point in the history
  • Loading branch information
llghdud921 committed Jul 25, 2022
1 parent 80cb013 commit 8e7bf9c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ class WMultiLineTextLabel: UILabel {
}

func setText(string: String) {
let attrString = NSMutableAttributedString(string: string)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineHeightMultiple = 1.33
attrString.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: NSMakeRange(0, attrString.length))
let attrString = NSMutableAttributedString(string: string, attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle])
attributedText = attrString
}

Expand Down
6 changes: 2 additions & 4 deletions Weekand/Weekand/Presentation/Common/View/WTitleLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ class WTitleLabel: UILabel {
}

func setText(string: String) {
let attrString = NSMutableAttributedString(string: string)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 5
// legacy code
attrString.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: NSMakeRange(0, attrString.length))
paragraphStyle.lineHeightMultiple = 1.25
let attrString = NSMutableAttributedString(string: string, attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle])
attributedText = attrString
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ class PasswordFindViewController: UIViewController {
$0.tintColor = .gray400
}

lazy var titleLabel = WTextLabel().then {
$0.text = "๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ\n์žŠ์œผ์…จ๋‚˜์š”?"
$0.font = WFont.title()
$0.numberOfLines = 0
lazy var titleLabel = WTitleLabel().then {
$0.setText(string: "๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ\n์žŠ์œผ์…จ๋‚˜์š”?")
}

lazy var informLabel = WMultiLineTextLabel().then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ class SignInViewController: BaseViewController {
private let disposeBag = DisposeBag()
var viewModel: SignInViewModel?

lazy var titleLabel = UILabel().then {
$0.text = """
๋ฐ˜๊ฐ€์›Œ์š”!
ํ•จ๊ป˜ ์ผ์ • ๊ด€๋ฆฌํ•ด์š” :)
"""
$0.font = UIFont(name: "PretendardVariable-Bold", size: 24)
$0.numberOfLines = 0
lazy var titleLabel = WTitleLabel().then {
$0.setText(string: """
๋ฐ˜๊ฐ€์›Œ์š”!
ํ•จ๊ป˜ ์ผ์ • ๊ด€๋ฆฌํ•ด์š” :)
""")
}

let spacerView = UIView()
Expand Down

0 comments on commit 8e7bf9c

Please sign in to comment.