Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 tvOS 中编辑UITextField会显示一个新视图,用户可以在其中输入文本,当文本输入完成后,用户会返回到前一个视图。但是,我发现当我从文本编辑器返回时,我编辑的文本不会显示在我的文本字段中。这是怎么回事?
UITextField
tvOS 版本 9.1
它不起作用的原因是因为UITextField它使用了非默认背景颜色。显然在 tvOS 中,背景颜色会在文本渲染后渲染到图层(有趣的是,这不会影响占位符文本)。这也发生在界面生成器中。已向 Apple 发送错误报告。
我在共享 iOS/tvOS 代码时遇到了类似的问题,其中下一个文本字段占位符文本消失并且没有响应。确保您没有设置textField.endEditing(true)
textField.endEditing(true)