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:

  1. make string global variable , set vc1 , later on
    access vc4 (not preferred).
  2. while instantiating destination vc pass value variable
    vc1 -> vc2 -> vc3 -> vc4, in way can required data in vc4.

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -