Forgive me if I completely misunderstand this question, but it looks like you just want to make a basic horizontal click back and forth between two view controllers. And even if you already understood this, perhaps this will help anyone who has the same question.
(1) In your storyboard (with ViewController A and B), create a Modal Segue from A to B. Give it an identifier (showViewControllerB) and select Transition: Flip Horizontal.
We installed the protocol and the delegates:
(2a) In ViewControllerB.h add above @interface:
@class ViewControllerB; @protocol ViewControllerBDelegate - (void)viewControllerBDidFinish:(ViewControllerB *)controller; @end
(2b) Add a delegate as a property:
@property (weak, nonatomic) id <ViewControllerBDelegate> delegate;
(3a) In ViewControllerB.m, it synthesizes:
@synthesize delegate;
(3b) And the delegate in the method for returning:
- (IBAction)flipBack:(id)sender { [self.delegate viewControllerBDidFinish:self]; }
(4) In ViewControllerA.h add to the very top #import "ViewControllerB.h" and at the end of @interface <ViewControllerBDelegate>
(5a) In ViewControllerA.m, add a method to comply with the protocol:
- (void)viewControllerBDidFinish:(ViewControllerB *)controller { [self dismissModalViewControllerAnimated:YES]; }
(5b) Then set it as a delegate in prepareForSegue:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"showViewControllerB"]) { [[segue destinationViewController] setDelegate:self]; } }
Hope this answers your question. If I do not understand, just let me know.