Design Element
Comment on "New Objective-C Tutorial"
by Dan Ribar — Jun 05
Scott - thanks for this post. It has helped me a lot!

One of the things i'm stuck on is [using your example] that I can't set and then read a variable from an outside class. It keeps going back to null....

So if I set 'caption' from one method
and try to get the value that is on 'caption' from another method, it is gone. I know there is discussion above, but i'm not too sure what the resolution is.

I am using something like this to read the 'caption' value:

photo* myPhoto = [[photo alloc]init];

myPhoto.caption=@"some caption";
NSLog(@"caption: %@",myPhoto.caption);
in this example all is well.

now in the same class I try this method and the value is now null

NSLog(@"caption: %@",myPhoto.caption);

dude - not too sure what I'm missing. Must be part of the to objective-c cycle... arghhh..

any thoughts?

Dan Ribar
Back to "New Objective-C Tutorial"
Design Element

Copyright © Scott Stevenson 2004-2015