Possible Duplicate:
dismissModalViewController AND pass data back
I'm new to ios development and stuck on this problem:
I'm using storyboarding and have a navigation controller, vcA
, with a TableView
in it which shows some data from a MutableArray
(which is initialized in viewdidload
of the same class). After selecting any cell, a second view controller, vcB
, is shown with a TextField
in it and a button called "Add to list".
What I want is that when I enter some text in the TextField
and press the "Add to list" button the text should be added to the array of previous view (which gets shown in the TableView
) and when i tap the "Back" button on vcB
's navigation bar, vcA
should show the updated TableView
with the new entry in it (on the top of list). Basically I want to add the text from vcB
's TextField
to the array of vcA
and show the new array after clicking the BACK button.
I have searched a lot about this issue and seem to find that delegate and protocols is the way to achieve the desired result but I'm having trouble understanding delegation.