So I have 3 view controllers in storyboard, (VC1, VC2 & VC3).
Each view has a button that calls an IBAction, which calls this method to go modal to another view:
[self doSegue: myViewController_ID];
-(void) doSegue:(NSString *)_myViewController_ID
{
//get UiViewController from storybord with Unique ID
UIStoryboard *storyboard = self.storyboard;
UITableViewController *svc = [storyboard instantiateViewControllerWithIdentifier:_myViewController_ID];
//set presentation & transition styles
svc.modalPresentationStyle = UIModalPresentationFullScreen;
svc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
//do segue
[self presentViewController:svc animated:YES completion:nil];
}
Lets set that I go from VC1 to VC2, once at VC2
What I want is to remove previous ViewController (VC1). and if I now go to VC3 from VC2 I want remove from view hierarchy or stack VC2 and so on.
This is since I will not be providing a [self dismissViewControllerAnimated:YES completion:nil];
method
I don't want the memory to be growing as result of all the view controller accumulation in the stack.
NOTE: I will not be using a navigation controller or tab controller , just the view controller.
Thanks for your help.