有什么方法可以更改“更多”选项卡上的标题(uitabbaritem 上的文本)?
3 回答
好吧..如果要更改更多选项卡的导航栏标题,请使用7KV7给出的方法
如果您想更改标签标题...
还有一种方法。。
假设你有八个标签..
1)在您的选项卡栏控制器中...只制作五个选项卡...删除五个选项卡以外的所有其他视图..
2)让你的第五个选项卡作为你的“更多选项卡”......把它作为一个 tableviewController 并在它的 tableView 元素中添加元素作为你的第六个..第七个..第八个选项卡的名称和图像......
3)在 FifthViewController 的 rowdidselect 方法中导航第六个、第七个和第八个选项卡各自的视图控制器。
优点:-您可以更改更多选项卡的名称和图像
缺点:-您不能使用更多选项卡的编辑按钮,您可以在其中更改选项卡元素的顺序。
如果您对此感到满意,请尝试..
In your UITabBarController you just add this simple line under the viewDidLoad and under superViewDidLoad:
self.moreNavigationController.navigationBar.topItem.title = @"Your Title";
So then it should look like this:
- (void)viewDidLoad {
[super viewDidLoad]; // Do any additional setup after loading the view.
self.moreNavigationController.navigationBar.topItem.title = @"Mer";
}
To make it worked I also created a new Objective-c class naming it: "MyTabBarController". And then I clicked my TabBarController in storyboard and set the class to: "MyTabBarController". When I pasted the code in the .m file it worked perfectly.
取自此链接
对的,这是可能的。
UINavigationBar *moreNavigationBar = tabBarController.moreNavigationController.navigationBar;
moreNavigationBar.topItem.title = @"Your title";
tabBarController 是你的 UITabBarController