If you've pushed onto a navigation controller (push segues, with a visible back button) then you use this code to go back:
[self.navigationController popViewControllerAnimated:YES];
If you've used modal segues, use this:
[self dismissViewControllerAnimated:YES completion:nil];
In both cases self
is the currently visible view controller.