jverdi/JVFloatLabeledTextField

JVFloatLabeledTextView Can't adjust the placeholderLabel's x position

anhpt681995 opened this issue ยท 4 comments

Hi,

I wanting to change the text inset of JVFloatLabeledTextView, everything is fine except the placeholderLabel. For content of the UITextView, I just need to adjust the textContainerInset, with floatingLabel, I can see there 2 public APIs is floatingLabelXPadding and floatingLabelYPadding. But with placeholderLabel, it has only one public API is placeholderYPadding.

So I'm wondering how to adjust the placeholderLabel's x position?

Hi - I don't think we currently account for this, or provide a way to customize it.

In JVFloatLabeledTextView.m, in the setLabelOriginForTextAlignment method, I'm thinking we should add self.textContainerInset.left to the x in the first line. (If so, we should add the self.textContainerInset.right to the NSTextAlignmentRight and NSTextAlignmentNatural cases too)

Want to give that a shot?

First at all, thanks for your response. However, I think I'll not make the change in the framework's source code. I'm worrying that when JVFloatLabeledTextView release a new version and I update it via CocoaPods, those codes will be lost and my UI will be wrong. So, I'll solve this problem in Interface Builder with some tricks.

Only one thing left, I'm wondering why we can't create a public API for this?

I think he is suggesting forking this repository and making the changes on the actual repo yourself!

Then you can submit the changes to him via GitHub. If it's accepted, when a new version is released, it will include your changes. ๐Ÿ‘๐Ÿผ

you can adjust it by changing origin.x of JVFloatLabeledTextView.
For example, set floatingLabelXPadding 0, and set origin.x of JVFloatLabeledTextView 16.
This works for me.