3

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.

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.