开发者

How could I get object from another class

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> {

 UIL开发者_如何转开发abel *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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜