Skyscanner / SkyFloatingLabelTextField

A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift.
Apache License 2.0
4.09k stars 540 forks source link

how to align the text to keep it in the middle #217

Open abhijitpp opened 6 years ago

abhijitpp commented 6 years ago

Report

What did you do?

ℹ I am trying to make an OTP Screen page in iOS i have achieved all the functionality just i got one issue that i want it keep the text in the middle of the textfield

What happened instead?

ℹ it starts from the exact corner of the text field

Xcode Version: 9.2 SkyFloatingLabelTextField Version: updated version Method of Integration: CocoaPods | Carthage | Manual : CocoaPods

k0nserv commented 6 years ago

Hey @abhijitpp can you give some more details on this? The component is an extesions of UITextField so any method that works for centering text in a UITextField should be applicable

vindicatesociety commented 5 years ago

sky ignores the alignment property of the base textfield.

m3rLin0WoRK commented 5 years ago

It should appear like this

(Watch vertical centering)

Thank you!

hiteshimpinge commented 5 years ago

@abhijitpp , Update the function as below in SkyFloatingLabelTextField class -

fileprivate func updateTextAligment() { if isLTRLanguage { textAlignment = .center titleLabel.textAlignment = .center } else { textAlignment = .right titleLabel.textAlignment = .right } }

suhailshaikh001 commented 4 years ago

Same issue here. Can't align the text to right of text field. Can anyone help?