2011-06-08 20 views
0

我添加了一個UINavigationBar的到我UIViewUINavigationBar的問題

我想設置標題,其leftbar byut失敗

我用下面的代碼

self.title = @"Edit Table "; 
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStyleBordered target:self action:@selector(EditTable:)]; 
[self.navigationItem setLeftBarButtonItem:addButton]; 
[super viewDidLoad]; 

沒有什麼改變,我叫這個uiview使用

self.NodeSelection = [[NodesList alloc]initWithNibName:@"NodesList" bundle:nil]; 
[self presentModalViewController:self.NodeSelection animated:YES]; 

任何建議請

+0

你是如何創建的導航項目? – 2011-06-08 07:45:34

+0

看到我的最後評論請在下面回答 – 2011-06-08 09:04:11

回答

2

更新

調用此查看使用

[self.navigationController pushViewController:self.NodeSelection animated:YES]; 

您可以使用此

self.navigationItem.title = @"Hello"; 

和對於leftBarButton你的代碼是正確的改變導航欄的標題。

第二次更新

對於迴歸父屏幕

[self.navigationController popViewControllerAnimated:YES]; 
+0

的問題是,navigationbaritem,不更新 – AMH 2011-06-08 07:40:06

+0

看到我的編輯答案 – 2011-06-08 07:43:21

+0

請問如何要返回到父畫面 – AMH 2011-06-08 08:21:16

0
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStylePlain target:self action:@selector(EditTable:)]; 
[self.navigationItem setLeftBarButtonItem:addButton]; 
[addButton release]; 
+0

AMH的代碼中沒有問題LeftBarButtonItem – 2011-06-08 07:46:45