I know this question is frequently asked by many users but, i didn't get my answer. I have three view controllers like vc1 , vc2 and vc3. In the first vc1 i have a form that takes some data from user and a table view that select some item from list, on vc1 i have submit button, When i hit submit button it moves to vc2.In vc2 i have some image views that select picture from gallery and display on image view and a submit button at bottom, when hit submit button it moves to next vc3. In vc3 it takes name in text and at bottom a submit button.Now i want that when user dil up the vc1 form and hit submit button the data should be save in any variable and when switch to vc2 and take a picture and move to vc3 and entering the after al this process when it hit submit button all the data he/she put in vc1,vc2and vc3 should be submitted once on the web service. How can i do this , I'm quite new.Im using storyboards and segue for switching to different view controllers.
Asked
Active
Viewed 419 times
0
-
You can use prepare for segue to pass data from one vc to another vc after reached the last vc then call the Web service for save the data on server ,There are many ways to pass data from one vc to another vc like delegate,NSNotificationCenter,using Property – Bhupat Bheda May 12 '17 at 12:05
-
you can take a dictionary for passing data from one view controller to another view controller. Just pass dictionry with data to another view controller and append it with new data. – Jitendra Modi May 12 '17 at 12:06
-
@BhupatBheda Yeah there are too many ways to do it. Just search through it – Jitendra Modi May 12 '17 at 12:07
-
Reference: http://www.appcoda.com/storyboards-ios-tutorial-pass-data-between-view-controller-with-segue/ – Krunal May 12 '17 at 12:07
-
@BhupatBheda i am telling him that you are right. there are too many ways – Jitendra Modi May 12 '17 at 12:09
-
can u elaborate how we do from property method? @BhupatBheda – Hamza Imran May 12 '17 at 12:09
-
are you saving image as base64data? – Dimple Shah May 12 '17 at 12:11
-
yup. @DimpleShah – Hamza Imran May 12 '17 at 12:13
-
Suppose you want to send the data from first vc to second vc then you need to create @property (nonatomic, retain) NSString *myname in second vc and after that you can access this variable from your first vc and you can send it simple – Bhupat Bheda May 12 '17 at 12:13
-
how should i save data of the form in one variable so that i could send it to vc2? @BhupatBheda – Hamza Imran May 12 '17 at 12:19
-
http://stackoverflow.com/questions/39955344/pass-data-with-prepareforsegue/39955689#39955689 – jignesh Vadadoriya May 12 '17 at 12:23
-
http://stackoverflow.com/questions/41102084/pass-nsstring-value-to-another-viewcontroller-in-objective-c/41102158#41102158 – jignesh Vadadoriya May 12 '17 at 12:23
1 Answers
-1
On each controller save data in a variable and then pass it to next controller.And at third controller use these data to submit on server.

Yatendra
- 1,310
- 1
- 18
- 31
-
i need to how should i do that, i know we have to save it to variable but how to do. @Yatendra – Hamza Imran May 12 '17 at 12:14
-
by using property.Make a property nsdicationay and on submit bin action on each screen save data in nsdicatinay. and then pass – Yatendra May 12 '17 at 12:16
-
-
Yes@Hamza Imran @property (nonatomic, retain) NSString *myname like this – Bhupat Bheda May 12 '17 at 12:19
-
U can do something like that in your segue delegate method override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let yourViewController = segue.destination as! YourViewController verifyViewController.propertytoPass = self.property } – hament miglani May 12 '17 at 12:19
-