开发者

UITextView text property returns " " if " " is typed in by the user?

开发者 https://www.devze.com 2023-02-16 21:07 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消