I am using a simple protocol
to tell a delegate
when save button was tapped on VC2
so the view controller
can be dismissed by popViewControllerAnimated
by VC1
.
VC2
has a protocol
which VC1
confirms to.
VC2.h
#import <UIKit/UIKit.h>
@class VC2;
@protocol VC2Delegate <NSObject>
- (void)saveBtnWasTpdOnVC2:(VC2 *)controller;
@end
@interface VC2 : UITableViewController
@property (weak, nonatomic) id <VC2Delegate> delegate;
- (IBAction)saveBtnTpd:(id)sender;
@end
VC2.m
- (IBAction)saveBtnTpd:(id)sender
{
NSLog(@"save tapped");
[self.delegate saveBtnWasTpdOnVC2:self];
}
VC1.m
- (void)saveBtnWasTpdOnVC2:(VC2 *)controller
{
NSLog(@"saveBtnWasTpd"); // I don't see this NSLog!
[controller.navigationController popViewControllerAnimated:YES];
}
Hope you can help.