0

I have a UIViewController named mainScreenViewController that present a tableView of reminders. When the user selects the first cell (“Add reminder”) I present a UIPageViewController named newReminderPageViewController using presentViewController: animated: completion: and not using UINavigationController.

I have 2 UIViewControllers in the newReminderPageViewController (the pageView), one called colourViewController and the other called titleViewController. On colourViewController the user chooses a colour for the reminder and when the user swipes to the left (swipes to titleViewController using the pageView) the users chooses a title for the reminder.

On titleViewController you have also an “Add” button that creates the reminder (using a model class called Reminder and have 2 properties: colour and title) and go back to mainScreenViewController (using dismissViewControllerAnimated: completion:)

My problem is: I need to pass the new reminder that was created on titleViewController to an array called reminders on mainScreenViewController. I need the specific mainScreenViewController object that is under the newReminderPageViewController (the pageView) with all the information of it so I can’t create a new object (newReminderPageViewController *nRPVC=[newReminderPageViewController alloc]init];).

How can I pass the new reminder which was created on titleViewController to the reminders array on the existing mainScreenViewController?

Thank you!

Yhper
  • 183
  • 2
  • 14
  • 2
    Possible duplicate of [Passing Data between View Controllers](http://stackoverflow.com/questions/5210535/passing-data-between-view-controllers) – Hemang Dec 21 '15 at 10:51
  • Use the delegation pattern. What language are you using? – luk2302 Dec 21 '15 at 10:52
  • Or use `unwind segue`, its pretty easy to implement, just revert of normal `segue` – Tj3n Dec 21 '15 at 10:57

0 Answers0