我有一个 UICollectionViewController
,它就像一个分页,每个单元格都有自己的页面。
在导航栏上,它始终显示“返回”。
以下不会更改标题。
-(void)viewWillAppear:(BOOL)animated{
UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
initWithTitle: @"Back Button Text"
style: UIBarButtonItemStyleBordered
target: nil action: nil];
[self.navigationItem setBackBarButtonItem: backButton];
最佳答案
您需要使用此代码:
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Custom Title"
style:UIBarButtonItemStyleBordered
target:nil
action:nil];
请注意,您需要在后退按钮将指向的 View Controller 上进行设置。例如,如果 ViewControllerA
按下 ViewControllerB
到导航堆栈,然后您将在 ViewController
A
上使用此代码。
关于ios - 无法覆盖导航按钮 UICollectionViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16224682/