Skip to content

Commit

Permalink
[Add] #214 - setDefaultAttributes 메서드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
joonBaek12 committed Sep 2, 2023
1 parent e3683f1 commit d515d76
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pophory-iOS/Global/Extensions/UILabel+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@
import UIKit

extension UILabel {
func setDefaultAttributes(lineHeight: CGFloat, font: UIFont) -> [NSAttributedString.Key: Any] {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.maximumLineHeight = lineHeight
paragraphStyle.minimumLineHeight = lineHeight

let defaultAttributes: [NSAttributedString.Key: Any] = [
.paragraphStyle: paragraphStyle,
.baselineOffset: (lineHeight - font.lineHeight) / 4,
.font: font,
.foregroundColor: UIColor.black
]

return defaultAttributes
}

func setAttributedText(
text: String,
Expand Down

0 comments on commit d515d76

Please sign in to comment.