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.
我想在我的 textField 中添加一个变量占位符,当在 textField 中写入某些内容时,该文本应附加到占位符而不对占位符进行任何更改。我应该怎么做?
您可以通过使用 clearsOnBeginEditing 属性并将其设置为 FALSE 来执行此操作。
textField.clearsOnBeginEditing = 否;
如果您通过界面构建器创建文本字段,那么您必须转到界面构建器中的检查器(按命令 1),最后您必须取消选中开始编辑时清除选项。