Case 1 : Unwind Segue
This will work perfect according to your situation:
iOS Unwind Segue
Unwind Segues give you a way to “unwind” the navigation stack and specify a destination to go back to.
Case 2 : PopToRootViewController
If you Parent view is also your Root view controller, then you can easily get back using popToRootViewControllerAnimated:YES
.
Create own back button add it to navigation bar with method backButtonTouch
.
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", nil) style:UIBarButtonItemStyleDone target:self action:@selector(backButtonTouch:)];
Add above code into viewDidLoad
.
-(void)backButtonTouch:(id)sender{
[self.navigationController popToRootViewControllerAnimated:YES];
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…