I have 1 NSMutableArray. I want to write getter setter method to get that value of array in another file plz tell me if u have code for it.
A:
Hi,
Try this one.
@interface DemoAppDelegate : NSObject <UIApplicationDelegate> {
NSMutableArray *stories;
}
-(void) setStoriesArray:(NSMutableArray *)stories;
-(NSMutableArray *)getStoriesArray;
In Delegate implementation class .m
- (void) setStoriesArray:(NSMutableArray *) sumData{
stories = sumData;
}
- (NSMutableArray *) getStoriesArray{
if ( stories == nil ) { }
return stories;
}
SO you can access the array value into the another file, so you need to set an array by setter method and where you want that array, you just use getter method.
Thanks.
Pugal Devan
2010-06-08 09:11:57
A:
Make property of that array. Using property u can set or get that variable.
sandy
2010-06-08 12:58:35