iPhone 开发 - TabBarItem 的数量

发布于 2024-08-31 10:14:59 字数 92 浏览 3 评论 0原文

我想创建一个选项卡栏,其选项卡栏项目的数量由用户定义(假设它存储在变量 NumberOfTabBarItem 中)。有没有办法将选项卡栏项目放入某种数组中并显示? 谢谢!

I want to create a Tabbar that the number of tab bar items is defined by the user (let say it stores in a variable NumberOfTabBarItem). Is there a way to put tab bar items into some sort of array and display?
Thanks!

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

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

发布评论

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

评论(1

避讳 2024-09-07 10:14:59

从 UITabBar 类参考中,有一个属性...

@property(nonatomic, copy) NSArray *items

可以通过...访问,

- (void)setItems:(NSArray *)items animated:(BOOL)animated

因此您可以以编程方式加载带有 TabBar 项目的 NSArray 并使用该方法来显示它。

From the UITabBar class reference, there's a property...

@property(nonatomic, copy) NSArray *items

that can be accessed with...

- (void)setItems:(NSArray *)items animated:(BOOL)animated

So you can programmatically load up an NSArray with TabBar items and use that method to display it.

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