ios - Set Variable in ClassA and View in ClassB -


i'm new/learning objective-c , ios dev - have basic question here can't head around.

i have 2 classes.

in classa, in header file have defined nsstring object (planetnameimage) publicly accessible. in .m file set using:

self.planetnameimage = planetselected; 

in classb, i'm trying retrieve value first instanitate classa, using:

classa *claa = [[classa alloc] init]; 

then try call variable using:

nsstring *imagename = claa.planetnameimage; 

however isn't working - ideas?

thanks.

what about?

classa.h  @interface classa:nsobject    @property (retain, nonatomic) nsstring *planetnameimage @end  classb.m #import "classa.h"  @implementation classb - (void)somefunc   {       classa *instance = [classa new];       instance.planetnameimage = @"name of image";       nsstring *imagename = instance.planetnameimage;   } @end 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -