0

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.

1 Answer 1

1

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.

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

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.