Darko Hebrang
Darko Hebrang

Reputation: 115

Passing array to another class - Objective C

I manage to pass the following array from MessagesTableViewController.m to arraySelectedCategory in another class called MessageDetailViewController.m:

self.messageDetailViewController.arraySelectedCategory =
        [[NSMutableArray alloc] initWithObjects:@"Value 1",@"Value 2", @"Value 3", nil];

but how do I hand over an array stored in: NSMutableArray *categories;

self.messageDetailViewController.arraySelectedCategory = ?????

Thanks!

Upvotes: 0

Views: 1033

Answers (2)

Prerna
Prerna

Reputation: 369

You can use NSUserDefaults. The value can be used in whole program.

Upvotes: 0

Krumelur
Krumelur

Reputation: 32597

I take it that you want a copy of the categories array?

self.messageDetailViewController.arraySelectedCategory = [categories copy];

Upvotes: 2

Related Questions