Anton Tropashko
Anton Tropashko

Reputation: 5806

UILabel alignment of NSAttributedString

How would I align UILabel attributed text vertically and to the left horizontally? thanks

        let style = NSMutableParagraphStyle()
        style.alignment = NSTextAlignment.center

centers text both vertically and horizontally: the latter my designer does not fancy

Upvotes: 1

Views: 39

Answers (1)

gcharita
gcharita

Reputation: 8327

You just have to set the alignment property to .left. UILabel by default centers the text vertically:

let style = NSMutableParagraphStyle()
style.alignment = .left

Upvotes: 1

Related Questions