0

I am having issues with white space not being shown in UITextField when the textAlignment property is set to right. White spaces are only shown when another character is imputed.

Its the same issue as here but the shouldChangeCharactersIn solution using non breaking space is not working on ios 15 and and 16.

So far I was unable to fix this on iOS 15 and 16. I have opened issue trough feedback assistant. Anybody had any luck to make this work ?

beowulf
  • 546
  • 1
  • 10
  • 16
  • Right-alignment on `UITextField` is pretty buggy. Try it without implementing any delegate funcs (such as `shouldChangeCharactersIn`). Start typing. As we know, spaces do not take up space until a non-space char is typed. However... once you have filled the width of the text field -- so it has started scrolling out-of-view to the left -- start typing spaces. Type them slowly, otherwise the quick-double-space will insert a period. See what happens after you've typed 10 to 15 spaces. – DonMag Oct 07 '22 at 15:38
  • Based on some quick searching and experimenting... I'd say just accept the UIKit behavior if you need right-aligned text. (and file a bug report with Apple) – DonMag Oct 07 '22 at 15:42

0 Answers0