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

Should work with defaults dropping into Storyboard #12

Closed
joeljfischer opened this issue Oct 17, 2013 · 3 comments · Fixed by #13
Closed

Should work with defaults dropping into Storyboard #12

joeljfischer opened this issue Oct 17, 2013 · 3 comments · Fixed by #13

Comments

@joeljfischer
Copy link

Right now, just dropping it into a Storyboard has it working like an ordinary UITextField, can it be modified with sensible defaults to work out of the box in Storyboards? I saw a pull request adding support for Nibs, but when I tried to subclass a UITextField in a Storyboard, nothing changed.

@DimaVartanian
Copy link
Contributor

can you attach a sample project showcasing the problem? the pull request i submitted should've made it work.

@joeljfischer
Copy link
Author

https://github.com/joeljfischer/Test_Floating_Label

I really hope I'm not making an ass of myself by missing something stupid.

@DimaVartanian
Copy link
Contributor

Okay, I found the issue. JVFloatLabeledTextField depends on code to call its setter for the placeholder(- (void)setPlaceholder:(NSString *)placeholder), because that is where the text and size is set for the floating label. The nib does not call this setter when setting the placeholder so it is never called. As a quick/temporary fix, you can create an outlet in your view controller for the text field, and force a call to the setter in viewDidLoad, like this "_textField.placeholder = _textField.placeholder;" (assuming your outlet is called _textField). This will make it function normally.

As to why it is not being called, I'm not sure. I was under the impression that when setting attributes in interface builder, the system first tries to use a setter if there is one, and only is one is not found sets it directly. I would probably know more about this if I actually used storyboards and nibs, but I tend to code all my layouts.

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

Successfully merging a pull request may close this issue.

2 participants