ios - Access string from firstviewcontroller in fourthviewcontroller objective c -
hi can access string firstviewcontroller
in fourthviewcontroller
. used following code. when go fourthviewcontroller
string null.
firstviewcontroller.m #import "fourthviewcontroller.h" fourthviewcontroller view = [[fourthviewcontroller alloc] init]; view.devintext = devinput.text; //devinput uitextfield nslog(@"%@",view.devintext); // output correct fourthviewcontroller.h @property (nonatomic, strong) nsstring *devintext; fourthviewcontroller.m nslog(@"%@",_devintext); // output displays null
i see 2 approaches:
- make string global variable , set vc1 , later on
access vc4 (not preferred). - while instantiating destination vc pass value variable
vc1 -> vc2 -> vc3 -> vc4, in way can required data in vc4.
Comments
Post a Comment