UITextView text property returns " " if " " is typed in by the user?
Does anyone have a solution to this? I did some google-ing and came up with zilc开发者_如何学运维h. I have no idea why a UITextView would replace
with a space, but it is indeed happening.
It is easy to duplicate - type the non breaking space code I placed in the title of this question into a UITextView, and then look at the text property, you'll see a space.
Is there a fix for this?
You are out of luck. This is most likely a bug, and it seems it has been filed with Apple.
See post UITextField converts non-breaking spaces to spaces?.
As a workaround you can use the delegate method textViewDidChange:
to catch the keyboard input to keep track of any
occurrences and then react accordingly.
Cheers,
Sascha
精彩评论