-->

tvOS UITextField blank after editing

2019-02-25 09:06发布

问题:

Editing UITextField in tvOS shows a new view where the user can enter in text, and when text entry is done, the user is returned to the previous view. However, I have found that when I return from the text editor, the text I edit does not show up in my text fields. What's going on?

tvOS version 9.1

回答1:

The reason why it isn't working is because the UITextField is using a non-default background color. Apparently in tvOS, the background color is rendered to the layer after the text has been rendered (Interestingly enough, this does not affect placeholder text). This also happens in interface builder. A bug report has been sent to Apple.



回答2:

I had a similar issue with shared iOS/tvOS code where the next textfield placeholder text disappeared and became unresponsive. Make sure that you are NOT setting textField.endEditing(true)