3

我有一个导航控制器。控制器运行良好,并向我显示返回按钮以返回窗口。但是当我添加此代码以添加关闭按钮时:

- (void)viewDidLoad 
{
  [super viewDidLoad];

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

}

...然后后退按钮消失,我只能看到关闭按钮。为什么?

4

1 回答 1

2

问题出在

 dismissModalViewControllerAnimated 

我不得不使用

 [self.navigationController dismissModalViewControllerAnimated:YES];     
 [self.navigationController popToRootViewControllerAnimated:NO];
于 2012-09-05T07:59:14.860 回答