-3

Im building this app where my main VC will display at first a UITable with custom cells [each representing the title and the date of event]. Once the cell is clicked it will segue to another VC which include the further details about the event [in addition to the title and date], there will be a button [Like button] on this VC and when this button in clicked a copy of that event will automatically be stored in another VC, that VC is basically a UITable with custom cells so what will appear in this VC is the custom cells each with the title and the date of the events that the user liked before and the only way the user can get access to this VC is by clicking on "Like" Tab Bar in the bottom of the app.

I have found that there is a several ways to pass the data but I haven't found any single example that include passing data between one VC to another VC with custom cells.

The way I thought I would do it, is by passing data using delegates and protocols but Im not really sure what are the procedures to do that for my app, I would be very grateful if someone explains that for me and shows me some examples about that.

TheEye
  • 9,280
  • 2
  • 42
  • 58
user3066516
  • 21
  • 2
  • 7
  • cba to answer, but use tableview delegate to get cell, get info from cell, initiate new vc with props in header file, asign cell data to props in new vc, push segue programatically – Oscar Apeland Feb 19 '14 at 23:00
  • 1
    People aren't bothering to properly read your question (very very very few people are actually capable of reading a question properly)and are assuming its the same old question asked over and over again and that is why its getting downvoted. You need to more clearly rephrase and state the actual problem a) to get more attention b) because its not really clear what your actual problem is from your current description. If you're just asking for an example of how to use a delegate then that deserves a downvote as there's no way you cannot find zillions of examples if you look. – Gruntcakes Feb 20 '14 at 00:27

1 Answers1

0

You should use the prepareForSegue function on your first view controller to catch when the segue gets activated, and then pass the data to the destination view controller.

See here: Pass data between view controller segue

Community
  • 1
  • 1
TheEye
  • 9,280
  • 2
  • 42
  • 58
  • the link u have included it is irrelevant, I already know how to pass data from custom cell to details VC, my question is how to pass the data in the details VC by clicking on a button in that VC, and when I click on that UIButton nothing will happen (no segues) except a copy of that event will be stored in another VC with also custom cells !! – user3066516 Feb 19 '14 at 23:03
  • Sorry, than your question is not phrased clearly, I don't really get what your problem is. If you instantiate a view controller when you click a button, you can just pass any data to it you like, no need for delegates, and if you just show an already existing view controller then you should have a reference to that view controller already somewhere and you again can just pass the data to it. – TheEye Feb 19 '14 at 23:20