FahimF / FloatLabelFields

Text entry controls which contain a built-in title/label so that you don't have to add a separate title for each field.
MIT License
1.19k stars 107 forks source link

UITextField round border style support #8

Closed tbaranes closed 7 years ago

tbaranes commented 9 years ago

Isn't it possible to use a round border style with FloatLabelFields? That could be awesome

lastMove commented 9 years ago

It is actually supported, By exemple in storyboard select a FloatLabelFields. In the rightPanel select the "Attributes Inspector" the 4th one. In the TextField section you will find "Border Style". Hope it helps :)

tbaranes commented 9 years ago

That's what I thought too, but even after trying in my project, or in your sample, it's not working. Each time I set the UITextFieldBorderStyle to the round one, it's not keeping its state and going back to the rect style.

Did I miss something else?

loplopLover commented 8 years ago

Hello,

I'm here because of same reason. How can I solve this issue?

Lawgrin commented 8 years ago

@haydarKarkin @tbaranes The why i solved this was to do the following. Note i dove head first and didn't RTFM so if there is a simpler way rather use that

in the setup() function replace borderStyle = UITextBorderStyle.None with if borderStyle != UITextBorderStyle.None { layer.borderColor = UIColor.blue.CGColor layer.borderWidth = 1.0 layer.cornerRadius = 5 }

then to fix the height issue (locked on 30) ensure that you have some way to identify it (easier for this step) you can use placeholder text as an identifier Right click on the storyboard select "open as" > "Source Code" find you text look for the height attribute and set it to 55 seemed to work for me with my text size

Like i said try at own risk