UIBarButtonItem *barBtnItem = [[UIBarButtonItem alloc]initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(pop)];
self.navigationItem.backBarButtonItem = barBtnItem;
我把上面的代码放在iphone中它正在工作。当我为ipad尝试它时它不起作用。可能是什么原因?
先谢谢
答案 0 :(得分:0)
这会在推送新视图控制器之前更改NavigationBar
的{{1}}文本:
BackButton
它适用于iPhone和iPad设备。
看起来您已将UIViewController *myViewController = [[UIViewController alloc] init];
UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"My text" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backBarButtonItem;
[self.navigationController pushViewController:myViewController animated:YES];
与Interface Builder相关联,您应该看一下: