簡體   English   中英

UINavigationController 返回和關閉按鈕

[英]UINavigationController back and close button

我有一個導航控制器。 控制器運行良好,並向我顯示了返回窗口的后退按鈕。 但是當我添加此代碼以添加關閉按鈕時:

- (void)viewDidLoad 
{
  [super viewDidLoad];

  UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Chiudi" 
                                  style:UIBarButtonItemStylePlain target:self
                       action:@selector(dismissModalViewControllerAnimated:)];          
  
  self.navigationItem.rightBarButtonItem = doneButton;
  
  [doneButton release];

}

...然后后退按鈕消失了,我只能看到關閉按鈕。 為什么?

問題出在

 dismissModalViewControllerAnimated 

我必須使用

 [self.navigationController dismissModalViewControllerAnimated:YES];     
 [self.navigationController popToRootViewControllerAnimated:NO];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM