8
votes

Please help me fix this issue.

In iOS7, I set the UITextField alignment right. But when I input space as a first character in the text field. The cursor automatically move to left side of the text field as if the textfield is left-aligned.

This issue does not happen in iOS5, iOS6.

1
did you try my solution?ManicMonkOnMac

1 Answers

1
votes

I am assuming you don't wanna allow the user to enter space as the first character. If that's true this solution would work.

Wire your editing changed event of UITextField to this method.

- (void)removeSpace : (UITextField *)sender{

    if ([sender.text  isEqual: @" "]) {
        sender.text = @"";
    }


}