UITabBarItem 的标签

发布于 2024-07-25 20:27:19 字数 218 浏览 1 评论 0原文

当我使用此方法初始化 UITabBarItem 时:

- (id)initWithTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag

我是否需要为每个选项卡栏项目有一个不同的标签,或者(因为我不使用它们)我可以简单地使用相同的标签值对于他们所有人?

When I use the this method to initialize a UITabBarItem:

- (id)initWithTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag

Do I need to have a distinct tag for each tab bar item, or (since I don't use them) can I simply use the same tag value for all of them?

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

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

发布评论

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

评论(2

高跟鞋的旋律 2024-08-01 20:27:19

我很确定您可以将它们全部保留为 0 或您选择的任何其他数字。 每个 UIView 都可能有不同的标签,Interface Builder 默认将它们全部设置为 0。 我没有遇到任何问题。

I'm pretty sure you can just leave them all as 0 or any other number you choose. Every UIView can potentially have a different tag, and Interface Builder sets them all to 0 by default. I haven't run into any problems with this.

故乡的云 2024-08-01 20:27:19

来自 Apple 的 UITabBarItem 类参考:

标签 - 接收者的标签,一个整数,可用于标识应用程序中的栏项目对象。

所以看起来似乎并不重要。

From Apple's UITabBarItem class reference:

tag - The receiver’s tag, an integer that you can use to identify bar item objects in your application.

So it looks like it doesn't really matter.

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