當我顯示一個ABPersonViewController
時,我需要一個按鈕,允許我將其解除並返回到上一個屏幕。我如何添加這個?如何爲ABPersonViewController的導航欄添加一個返回按鈕?
1
A
回答
5
哦,我得到了答案。
ABPersonViewController *personViewController = [[ABPersonViewController alloc] init];
personViewController.addressBook = addr;
personViewController.displayedPerson = ABAddressBookGetPersonWithRecordID(addr, (ABRecordID)personID);
personViewController.allowsEditing = YES;
personViewController.personViewDelegate = self;
personViewController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Return",nil) style:UIBarButtonItemStylePlain target:self action:@selector(ReturnFromPersonView)];
0
爲Variant:
ABPersonViewController *personView = [[ABPersonViewController alloc] init];
[self.navigationController pushViewController:personView animated:YES];
personView.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"return" style:UIBarButtonItemStyleBordered target:self action:@selector(action:)];
+0
謝謝。但是,如果ABPersonViewController是導航控制器的初始視圖,也就是說,導航控制器的堆棧中沒有更多視圖,然後如何返回之前的視圖,該視圖不包含導航欄。 – pcjbird 2010-08-06 00:26:52
相關問題
- 1. 如何添加按鈕到導航欄?
- 2. iOS9導航欄返回按鈕無法
- 3. 添加後退按鈕到導航欄
- 4. 添加按鈕自定義導航欄
- 5. xcode添加按鈕導航欄
- 6. 將按鈕添加到導航欄
- 7. 在Xcode的導航欄左側添加一個按鈕
- 8. 如何在導航欄上添加2個按鈕?
- 9. 嚮導航欄添加兩個以上的欄按鈕項目
- 10. 如何隱藏iPhone上導航欄上的「返回」按鈕?
- 11. 如何將一個按鈕添加到這個WordPress的導航欄?
- 12. 將導航按鈕添加到統一標題欄/工具欄
- 13. 在導航欄中添加一個「+」按鈕
- 14. 在導航中添加第一個和最後按鈕欄
- 15. 防止導航欄中的默認行爲返回按鈕
- 16. iPhone導航返回按鈕
- 17. 如何添加一個簡單的按鈕到導航欄的中間?
- 18. 如何將按鈕添加到IntelliJ中的「導航欄」?
- 19. 導航欄按鈕
- 20. jQuery Slider - 如何添加導航按鈕?
- 21. 如何將TitleIcon和按鈕添加到NavigationPage導航欄?
- 22. 將右欄按鈕添加到導航欄的問題
- 23. 在導航欄上添加兩個以上的按鈕
- 24. 向ABPersonViewController添加額外的按鈕
- 25. 在導航欄中添加多個按鈕
- 26. 使用智能GWT手機添加多個按鈕,導航欄
- 27. 在iOS的頂部導航欄中添加多個然後一個按鈕
- 28. 如何對齊導航欄按鈕?
- 29. 與添加一個陰影導航欄
- 30. 導航欄上的多個按鈕
單擊編輯按鈕後,backBarButton將消失。 – 2013-04-19 01:06:53