I am getting data from NSTextField, and saving data in NSMutableArray. I want to show the sam开发者_如何学JAVAe data in another class which in child of UITableViewController.
How can I show data of NSMutableArray to myTableView which is another class??
Help me out, please Surely, I will appraise if I found proper way.
Your tableView is in a MyViewController
class. You need to create a NSMutableArray *sourceArray
attribute on that class, as well as the associated property, using for instance:
@property (nonatomic, retain) NSMutableArray *sourceArray;
Then when you instantiate this View Controller or whenever you make it appear, assign the results to sourceArray :
MyViewController *mvc = [[MyViewController alloc] initWith...];
mvc.sourceArray = theResult;
[self presentModalViewController:mvc animated:YES];
[mvc release];
Then use the sourceArray
as the Table View datasource.
Make a property of NSMutableArray in app delegate class and assign the result of the source array to it as soon as you fetch any result, because you can access its instance all over your project.
精彩评论