using an NSMutablearray in a different class
Well im new to objective c its my second week trying to get used to it, its going well but im kinda stuck, i have readed alot of articles about this problem on the internet but none have worked...
I'm developing for a ipad/splitview. I have got an rootviewcontroller were I fill an NSmutablearray
staticly and dynamicly and return them in a table on the navigation bar and this works perfectly.
And i have an detailviewvcontroller where I also want to acces this NSMutablearray of the rootviewcontroller. I can acces the array but there are no objects in it(but there are objects in it or else the navigationbar would have been empty).
i have got this so far: Rootviewcontoller.h
@class DetailViewController;
@interface RootViewController : UITableViewController {
NSMutableArray *listoflinks;
}
@property (nonatomic,retain) NSMutableArray *listoflinks;
@end
i also synthesize the array, no problem in this class..
DetailviewController.h
@interface DetailViewController : UIViewController <UIPopoverControllerDelegate, UISplitViewControllerDelegate,UIPickerViewDataSource,UIPickerViewDelegate> {
RootViewController *objRootViewController;}
@property(nonatomic,assign) RootViewController *objRootViewController;
@end
I also synthesize the object of the class in the detailviewcontroller.m file and when I use the objRootViewController.listoflinks to an controller it doesnt returns annything.. I have also tried to do this by making an NSMutablearray in the detailviewcontroller.m with the same attributes as I made for listoflinks and this works.. so the problem is getting the values of the array from the other class,
Keep in mind that there were more objects in these header files, but i haven't added them because the开发者_Python百科y have nothing to do with the array.
Put a singleton in your life!
精彩评论