Got a question, I’m trying to return to a previous view and share some data over to the frame I’m returning to. The data will be date and time and I would like to send this to a textField.
For example I’m calling the date *returneddate and the textField I’m calling *dateTime. The views are call *PickDateTime and SubmitEventsP2.
If you need more information just ask me and I’ll add it if I can to make it easier for you to help me.
I’m using Xcode 4.2.
Ok.. its pretty simple.. you should use a delegate… if i understood correctly, you are on a secondary view and when you return to the main view you wish to send the data from the second view back to the main view, right?
so, in your second view, in the .h file, on top of interface, you will declare the delegate with:
And in your interface, still in the .h, you will create a reference of this delegate like:
after that, in your .m of nameOfTheViewController you will do:
After you created you delegate in the nameOfTheViewController file, you will call the delegate method you just created exactly where and when you want to return to the previous view, filling it with the parameters you want to pass back… and of course, in your mainViewController, right in your didPrepareForSegue method, you will create a instance of the nameOfTheViewController class and set its delegate proeprty to self… for this to be possible, in your mainViewController .h you must conform to the nameOfTheViewControllerDelegate protocol.