UITabBarItem 的标签
当我使用此方法初始化 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我很确定您可以将它们全部保留为 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.
来自 Apple 的 UITabBarItem 类参考:
所以看起来似乎并不重要。
From Apple's UITabBarItem class reference:
So it looks like it doesn't really matter.