iphone - How can you share ivars between classes.? -
in 1 classes .h have
nsmutablearray *rountines; and in classes .m want this
[routines addoject:@"hello]; the other class modalviewcontroller type set up.
so, in essence i'd .m file of mvc able read, , edit , other things ivars declare in header.
cheers,
sam
edit
another example, similar im trying achieve edit screen.
you can't share ivars between classes really. ivar stands instance variable, , variable belongs particular instance of object. way solve problem allow other objects access object's state. commonly done through setter , getter methods. objective-c 2.0 makes easier providing @property , @synthesize keywords.
if had access object had routines array, access through property (getter method) this:
[[someobject routines] addobject:@"hello"];
Comments
Post a Comment