2013-03-07 42 views
0
UIBarButtonItem *barBtnItem = [[UIBarButtonItem alloc]initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(pop)]; 
    self.navigationItem.backBarButtonItem = barBtnItem; 

我把上面的代碼在iphone是working.when我試圖它爲iPad它不working.what可能是什麼原因?需要改變後退按鈕名稱導航欄上的在ipad

由於提前

+0

initWithTitle:@「WatYouWnat」 ......簡單亞爾 – iPatel 2013-03-07 12:04:39

+0

@iPatel我不能做那在ipad.but它的工作iphone – Ramgopal 2013-03-07 12:27:02

+0

self.navigationItem.title = @「你的文字」; – 2013-03-07 12:28:32

回答

0

這改變NavigationBarBackButton文本,推新視圖控制器之前做:

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]; 

它同時適用於iPhone和iPad設備。

它看起來像你鏈接您的UINavigationController與界面生成器,你應該看看這個:

enter image description here