在其他视图中更改 UItabbaritem 的标题?
启动应用程序时如何更改 UITabbaritem 标题?
我有一个带有 4 个选项卡的 UITabBar。我希望用户能够在两种不同的语言之间进行更改。如果用户选择不同的语言,我需要为 UITabbaritems 设置不同的标题。我知道我可以使用 self.title = @"title"; 但这只会更改当前的 tabbaritem 标题。如何在加载时以及选择不同语言时立即更改所有标题?
How do I change the UITabbaritem titles when starting the App?
I got a UITabBar with 4 tabs. I want the user to be able to change between two different languages. If the user chooses a different language I need to set a different title to the UITabbaritems. I know I can use self.title = @"title";
but that only changes the current tabbaritem title. How can I change all the titles at once, on load, and when choosing a different language?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题并解决了它。
其中 index 是您的 UITabBarItem 索引。
I got the same problem and solved it with.
Where index is your UITabBarItem index.
您需要将所有 UITabBarItem 存储到一个数组中,当用户点击按钮时,您需要循环遍历该数组并设置标题。
You need to store all your UITabBarItem into an array, when the user tap the button, you need to loop through that array and set the title.