如何更改 tabBarItem 名称?

发布于 2024-10-08 09:07:15 字数 433 浏览 0 评论 0原文

我正在使用基于 tabBar 的应用程序..tabBar 有四个 tabBarItem 名为,1.Home,2.Pictures,3.My_Pictures,4.Help...

在第二个视图(图片)中有 3 个按钮...当时单击第一个按钮,它会转到一个新视图(SimpleView),该视图有 4 个按钮...此时 tabbarItem 名称更改为图片中的颜色,我通过这样给出来完成此操作,

self.title=@"Colors" ;在按钮操作事件中...然后,当从 simpleView 中的 4 个按钮中单击按钮时,我想将 tabBarItem 标题从颜色更改为图片...我在中编写了相同的代码 self.title=@"Pictures"按钮操作事件...此时 tabBarItem 名称没有改变...我应该为此做什么... 请给我一些想法来做到这一点...

感谢您提前所做的努力... 雷努加

I'm working with tabBar Based Application..tabBar having four tabBarItem named as,1.Home,2.Pictures,3.My_Pictures,4.Help...

In 2nd view(Pictures)having 3 buttons...At the time click on the first button it goes to a new view(SimpleView)this view having 4 buttons...at this time tabbarItem name changed to Colors from pictures,i have done this by giving like this,

self.title=@"Colors"; in the button action event...Then i want to change the tabBarItem title to Pictures from colors when the button is clicked from among the 4 buttons in simpleView...I have write the same code self.title=@"Pictures" in the button action event...At this time the tabBarItem name doesn't change....what should i do for this...
please give me some ideas to do this...

Thank you for your effort in Advance...
Renuga

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

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

发布评论

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

评论(1

倦话 2024-10-15 09:07:15

TabBarController 有一项功能,当您更改任何导航视图控制器标题时,该标题将反映到 tabBar 项。

但你应该记住一件事,即

你可以通过主视图控制器更改 tabBarItem 名称,即引用特定的 tabBar,而不是子 ViewController。

例如:对于“图片”选项卡,您已经给定了 pictureViewContoroller,您可以仅使用该对象来更改 tabBar 项目名称。您无法通过剩余的视图控制器或对象进行更改。

问候,

萨提亚。

TabBarController has one feature that, when you change any navigation viewcontroller title, then that title will be reflected to tabBar item.

But you should remember one thing, i.e.,

you can change the tabBarItem name by the main viewcontroller, that is refered to the specific tabBar, but not the sub ViewController.

Ex: For Pictures tab, you have given pictureViewContoroller, you can change the tabBar item name, by using that object only. you can't change by remaining view controllers or objects.

Regards,

Satya.

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