gpt4 book ai didi

ios - 即使清除所有文本字段后如何保留占位符

转载 作者:行者123 更新时间:2023-11-28 18:34:33 27 4
gpt4 key购买 nike

所以我有 3 个文本字段。清除后,我希望占位符 STILL 保留在那里。到目前为止,大约过去一周我一直在与这个问题作斗争,没有人能够帮助我解决它。我想知道这是否可能?...

这是我在清除占位符后设置占位符的示例代码:

personYouOweMoney.text = @" ";
amtYouOwe.text = @" ";
self.cellNum.text = @" ";

personYouOweMoney.placeholder = @"Name of person you owe";
amtYouOwe.placeholder = @"Amount Owed (USD)";
self.cellNum.placeholder = @"Their cell number";

感谢所有帮助,提前致谢

最佳答案

您基本上是将 textField 的文本设置为一个空格,因此从技术上讲,它不是空的。
(只有当 textField 为空时才会看到占位符)

做:

//set the placeholder's and when you want to clear the textfield, this...
personYouOweMoney.text = @"";
amtYouOwe.text = @"";
self.cellNum.text = @"";

关于ios - 即使清除所有文本字段后如何保留占位符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21669462/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com