iOS:在 UITableViewCell 中显示所需 UITextField 的正确方法

发布于 2025-01-06 03:11:02 字数 166 浏览 4 评论 0原文

我尝试过谷歌并查看了 iOS 人机界面指南,但似乎找不到任何关于显示需要自定义 Grouped UITableViewCell 内的 UITextField 的最佳实践。

有什么建议或者有人见过其他应用程序是如何做到这一点的吗?我基本上是动态创建一个表单,并且需要让用户知道必须填写某些字段的某种方式。

I have tried google and looked at the iOS Human Interface Guidelines but cannot seem to find anything on the best practices for displaying that a UITextField inside of a custom Grouped UITableViewCell is required.

Is there any recommendations or has anyone seen how other applications do it? I am basically creating a form dynamically and need to let the user know some way that certain fields MUST be filled out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你没皮卡萌 2025-01-13 03:11:02

一般来说,星号是个好主意。如果您使用占位符文本,那么当用户填写该框时,他们将无法再看到它——因此填写的表单不会告诉您哪些字段是必填字段或不是。

我会在 UITextField 旁边放置一个小的 UILabel,并让该 UILabel 包含一个星号,可能是红色的。

或者,如果大多数字段都是必填字段,那么您可以在可选字段中使用占位符文本,即 (可选)

此外,您还可以创建一个方法来检查所有必填字段是否已填写。如果不是,请禁用“继续”按钮。如果是,则启用“继续”按钮。通过 UITextFieldDelegate 方法调用此方法。

Generally, an asterisk is a good idea. If you use placeholder text, then when the user fills in the box, they can't see it anymore --- so a filled-in form wouldn't tell you which fields were mandatory or not.

I would put a small UILabel next to the UITextField, and have that UILabel contain an asterisk, probably in red.

Or, if most of the fields are required, then you can use placeholder text in the optional fields, that says (optional)

Also, you can create a method that checks if all the required fields are completed. If they aren't, then disable the "Continue" button. If they are, then enable the "Continue" button. Call this method via a UITextFieldDelegate method.

二货你真萌 2025-01-13 03:11:02

您可以使用 UITextField 占位符属性来显示文本“名称为必填项”。这将向用户表明该字段是必填字段并且必须填写。

You can use the UITextField placeholder property to display the text "Name is required". This will indicate to the user that the field is required and must be filled.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文