objective c - iOS self.delegate is nil even after being set -


i have controller gets instantiated , pushed onto navigation controller -

in parentvc.m

thingcontainerviewcontroller *thingcontainer = [[thingcontainerviewcontroller alloc] init]; thingcontainer.delegate = self;  [self.navigationcontroller pushviewcontroller:thingcontainer animated:yes]; 

now want send value parentvc when thingcontainer closed. have implemented delegate follows:

in parentvc.h

@interface parentvc : uiviewcontroller <..., thingcontainerviewcontrollerdelegate> 

in thingcontainer.h

@protocol thingcontainerviewcontrollerdelegate <nsobject> - (void)additemviewcontroller:(id)controller didfinishenteringitem:(nsinteger)page; @end ....  @interface ....  @property (nonatomic, weak) id <thingcontainerviewcontrollerdelegate> delegate;  .... @end 

in parentvc.m

- (void)additemviewcontroller:(id)controller didfinishenteringitem:(nsinteger)page {     self.page = page; } 

in thingcontainer.m

- (iboutlet) ... closebuttonwastapped:(uibutton *)button {     nslog(@"%ld", (long)indexofpage);     [self.delegate additemviewcontroller:self didfinishenteringitem:indexofpage];     [[self navigationcontroller] popviewcontrolleranimated: yes]; } 

at point, self.delegate null, method in parentvc never gets called. idea how can fix it?


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -