- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self showBackBtn:YES];
}
- (void)returnClick {
if ([[self.navigationController viewControllers] count] ==1) {
[self dismissViewControllerAnimated:YES completion:^{
}];
}else{
[self.navigationController popViewControllerAnimated:YES];
}
}
#pragma mark - 显示返回按钮
- (void)showBackBtn:(BOOL)show {
if (self.navigationItem)
{
if (show)
{
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"title_bar_back"] style:UIBarButtonItemStyleDone target:self action:@selector(returnClick)];
self.navigationItem.leftBarButtonItem = item;
}
}
}