Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is text centered when setting icon to UILabel? #32

Open
Jaszkowic opened this issue May 22, 2018 · 0 comments
Open

Why is text centered when setting icon to UILabel? #32

Jaszkowic opened this issue May 22, 2018 · 0 comments

Comments

@Jaszkowic
Copy link

Why does the function UILabel.setIcon(...) change the alignment of the text on the label to .center? The documentation on these functions do not specify that the alignment is changed. I found this to be unexpected behavior and I don't want to the alignment on my label to be changed when using this function.

Found in SwiftIcons.swift in the following functions:

setIcon(prefixText: String, prefixTextColor: UIColor = .black, icon: FontType?, iconColor: UIColor = .black, postfixText: String, postfixTextColor: UIColor = .black, size: CGFloat?, iconSize: CGFloat? = nil) {
    // ...
    textAlignment = .center
}

setIcon(prefixText: String, prefixTextFont: UIFont, prefixTextColor: UIColor = .black, icon: FontType?, iconColor: UIColor = .black, postfixText: String, postfixTextFont: UIFont, postfixTextColor: UIColor = .black, iconSize: CGFloat? = nil) {
    // ...
    textAlignment = .center
}

Is there a reason why the alignment is changed? If not I would suggest removing the line.

@Jaszkowic Jaszkowic changed the title Why is text centered when setting Icon to UILabel? Why is text centered when setting icon to UILabel? May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant