非活动 UIBarButtonItem

发布于 2024-09-28 15:45:43 字数 104 浏览 1 评论 0原文

有人知道联系人应用程序中的非活动完成按钮是如何完成的吗?

我想实现类似的东西。

到目前为止,我还没有在 UIBarButtonItem 上看到任何非活动属性...

Does someone know how the inactive done button in the Contacts App is done?

I would like to implement something similar.

So far I haven't seen any inactive property on UIBarButtonItem...

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

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

发布评论

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

评论(1

花开半夏魅人心 2024-10-05 15:45:43

使用enabled 属性。当然,您需要对视图控制器中的输入控件使用自己的验证检查,以确定是否将其设置为启用。

// Assuming the Done button is on the right
[self.navigationItem.rightBarButtonItem setEnabled:NO]; // Disables the button

enabled 属性位于 UIBarItem 中,UIBarButtonItem 继承自该类,这就是为什么您在UIBarButtonItem 文档。

Use the enabled property. Of course, you'll need to use your own validation checks on the input controls in your view controller, to determine whether or not to set it enabled.

// Assuming the Done button is on the right
[self.navigationItem.rightBarButtonItem setEnabled:NO]; // Disables the button

The enabled property is found in UIBarItem, the class from which UIBarButtonItem inherits, which is why you won't find it in the UIBarButtonItem docs.

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