I have a UIView->UICollectionView->UICollectionViewCell
. I am trying to navigate back programatically but none of these works. The code did called.
I am using StoryBoard.
- (void) goBack:(NSNotification *) notification {
// [self.navigationController popViewControllerAnimated:YES];
// [self dismissViewControllerAnimated:YES completion:nil];
[self.navigationController popToRootViewControllerAnimated:YES];
}
Go back to parent view controller and dealloc current view controller ex :
or another view controller
With swift3,
By using below line we can go to parent view controller
By using below line we can move to main/root view controller
By using below line we can move to any view controller
Swift solutions for easy copy pasting:
How about...
Assuming that you are currently in a navigation-based controller and you wanted to go back to the previous controller before you got into a navigation-based controller.
Swift 4.1: