[英]setting title on navigation bar not working
I want to set title to my navigation bar.我想为我的导航栏设置标题。 I'm using
我正在使用
[self.navigationItem setTitle:@"Some Title"];
But, the back button title is changed not the navigation bar title.但是,后退按钮标题不是导航栏标题。
尝试设置 UINavigationController 的标题:
[self.navigationController setTitle:@"Title"];
Use this by this only navigation bar's title will change not back button's title仅使用此导航栏的标题将不会更改后退按钮的标题
self.navigationItem.title=@"myTitle";
UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
initWithTitle:@"Back"
style:UIBarButtonItemStylePlain
target:nil
action:nil];
self.navigationItem.backBarButtonItem=backButton;
Did you implement back button like this way if not use this code如果不使用此代码,您是否以这种方式实现后退按钮
self.navigationController.navigationBar.topItem.title = @"myTitle";
or或者
in .h在.h
IBOutlet UINavigationItem *navItem;
in .m在.m
navItem.title = @"New Title";
[self.navigationController.navigationItem setTitle:@"Title"];
Adding this to your current view controller:将此添加到您当前的视图控制器:
[self setTitle:@"Your Title"]
or set it up at previous view controller:或在以前的视图控制器中设置它:
destinationViewControl.title = @"Your Title"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.