大家好我有一个导航控制器, 控制器工作正常,并显示返回窗口的后退按钮 但是当我添加这个代码来添加关闭按钮时:
- (void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Chiudi"
style:UIBarButtonItemStylePlain target:self
action:@selector(dismissModalViewControllerAnimated:)];
self.navigationItem.rightBarButtonItem = doneButton;
[doneButton release];
}
后退按钮消失,我只能看到关闭按钮 为什么?
答案 0 :(得分:2)
问题在于
dismissModalViewControllerAnimated
我必须使用
[self.navigationController dismissModalViewControllerAnimated:YES];
[self.navigationController popToRootViewControllerAnimated:NO];