objective c - How to call function/method in parent view controller -


i have myviewcontroller has uinavigationcontroller subview , uinavigatiocontroller has customview popped on stack. want in customview call method in myviewcontroller.. tried this:

uinavigationcontroller *main = (uinavigationcontroller*)[self parentviewcontroller];     myviewcontroller *parentcontainer = (myviewcontroller*)[main parentviewcontroller]; [parentcontainer myparentmethod]; 

this code not correct.

the parentviewcontroller property works navigation controller, tab bar controller, or in modal presentation relationship. although myviewcontroller object has view of uinavigationcontroller object subview, doesn't mean myviewcontroller parentviewcontroller of uinavigationcontroller object.

if have keep design , need access myviewcontroller object customview object, best way of doing let customview object have weak reference myviewcontroller object (like delegate properties).


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -