Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I display MSMutableArray data in UITableViewController?

I am getting data from NSTextField, and saving data in NSMutableArray. I want to show the same 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.

like image 252
Chatar Veer Suthar Avatar asked Dec 28 '25 01:12

Chatar Veer Suthar


1 Answers

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.

like image 81
Sylvain Avatar answered Dec 30 '25 16:12

Sylvain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!