-2

Possible Duplicate:
ios5 how to pass prepareForSegue: an object

I love storyboards, but i cannot pass data from viewController1 to viewController2 using storyboards. I have researched, and found out a little about prepareForSegue. But im still lost! How can I simply pass a string from vc1 to vc2 when using prepare for segue? I have 1 button to switch views, and pass the string. Thanks in advance!

:D

Community
  • 1
  • 1
iProRage
  • 424
  • 7
  • 19

1 Answers1

2

Here is some tutorial for passing data between ViewControllers using Storyboard:

  1. Storyboards Segue Tutorial: Pass Data Between View Controllers
  2. Tutorial on How-To Pass Data Between Two View Controllers

or use something like this(just an example):

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:...]) {
        MyViewController *controller = (MyViewController *)segue.destinationViewController;
        //What you are going to pass, for my example score as int
        controller.score = score;
    }
}

Hope this helps.

Bazinga
  • 2,456
  • 33
  • 76