gmertk / ParkedTextField

A text field with a constant text/placeholder
MIT License
862 stars 50 forks source link

Preceding placeholder #6

Open dmiedema opened 9 years ago

dmiedema commented 9 years ago

There's still some bugs with the caret when there is no text which is kinda interesting

untitled

gmertk commented 9 years ago

I see the problem with the cursor here.

When there is no text, placeholder is taking its place. This moves to cursor to the beginning as in a default UITextField.

I am not sure if there is a way to move the cursor in the placeholder. I am on it...

dmiedema commented 9 years ago

:+1: I'll update the conflicts in the mean time

gmertk commented 9 years ago

I still couldn't find a way to move the cursor to the end when there is no text.

One way seems to set the textAligment to .Right temporarily. It moves the cursor to the right, but it also changes the alignment as the name suggests.

Will think about this...

vicc commented 9 years ago

How about something like:

- (UITextPosition *)closestPositionToPoint:(CGPoint)point{
    if (!parkedTextAtEnd && text.length == 0) {
        UITextPosition *trueBeginning = self.beginningOfDocument;
        UITextPosition *betterBeginning = [self positionFromPosition:trueBeginning offset:parkedText.length];
        return betterBeginning;
    }
}

Note: I haven't tried it being that the project won't compile for me.

katoree commented 8 years ago

Has there been any update on this? Was trying to figure out the caret issue but no luck yet. Very interested in getting this to work with the preceding text

dmiedema commented 8 years ago

Nope :disappointed: unfortunately i got busy with work and it fell by the wayside.