Reputation: 1
I am using a utility application in storyboard. I also created a third viewcontroller, which is accessed through a segue from the flipsideviewcontroller. I want to add a value in the third viewcontroller to an NSMutableArray that exists in the mainviewcontroller. I have played around with "delegation", but I have not been able to get it to work. My question is, how do I access my array that is defined in the mainviewcontroller from the third viewcontroller? Thanks.
Upvotes: 0
Views: 148
Reputation: 8907
When you create the 3rd view controller you can set a weak property that points to that array. Or you can define a delegate protocol that the 3rd view controller has a reference to, but the main view controller implements:
my3rdviewcontroller.delegate = mainViewController;
then in my3rdviewcontroller:
[self.delegate addValue:myValue];
and of course mainViewController implements the addValue: message.
Upvotes: 1