If I want get one Label.text from View1,
so I set in firstView.h
@interface RootViewController : UITableViewController {
NSMutableArray *menuList;
}
@property(nonatomic,retain)NSMutableArray *menuList;
@end
in secondView.h
@interface SecondViewController : UIViewController <UIPickerViewDelegate,UIPickerViewDataSource> {
UILabel *comboView;
}
@property (nonatomic,retain)UILabel *comboView;
@end
in secondView.m
FirstViewController *firstViewController = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
[firstViewController.menuList addObject:comboView.text];
but when I want to get object from menuList in firstView(self.menuList)
It become “null”!!!
What’s the problem??
Thanks
Mini
The code provided is very limited, did you remember to initialize the ‘menuList’ before adding objects? Objective C lets you add objects to uninitialized array’s, so a mistake is easily made.