EFPrefix / EFCountingLabel

Adds animated counting support to UILabel.
https://swiftpackageindex.com/EFPrefix/EFCountingLabel
MIT License
500 stars 63 forks source link

Center text #8

Closed bermanapps closed 6 years ago

bermanapps commented 6 years ago

How do I center the text in the view? Thanks

bermanapps commented 6 years ago

Like this: (for swift 4) countingLabel.textAlignment = .center

EyreFree commented 6 years ago

@bermanapps

If you use attributedFormatBlock you can set:

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

...

let attributedText = NSMutableAttributedString (
        string: "xxxxxx", attributes: [
            NSAttributedStringKey.paragraphStyle: style
        ]
)

else just set countingLabel.textAlignment = .center of EFCountingLabel.