In UINavigationController this is child controller
.h
@protocol childProtocol <NSObject>
-(void)childMethod:(NSArray*)params;
@end
@property (strong, nonatomic) id<childProtocol>childDelegate;
@property (weak, nonatomic) parentVC *pVC;
.m
if([self.childDelegate respondsToSelector:@selector(childMethod:)]) {
[self.childDelegate performSelector:@selector(childMethod:) withObject:self.arry];
}
This is my parent controller
.m
-(void)childMethod:(NSArray *)params {
// some work
}
...
childVC *cVC = [[childVC alloc]init];
cVC.pVC = self;
But childMethod: is not getting called so I searched on internet and got this post UINavigationControllers: How to pass value to higher (parent?) controller in stack?
I tried to create a weak reference but dont know how to use to make delegate pass data from child to parent?