title: Retain UILabel value between random views
body: <p>I'm making a view based quiz app for the iPhone where the player is going randomly between three different views when answering the questions. They get +1 when answering correct and -1 when tapping the wrong answer. But after answering the question, when you go to the new random view, I need the UILabel to show the score from the previous view. How do I do that?</p>
  
  <p>Here is my code:</p>
  
  <p>ViewController.h</p>
  
  <pre><code>@interface ViewController : UIViewController {
  
      IBOutlet UILabel *labelQuestion;
  IBOutlet UILabel *labelAnswer1;
  IBOutlet UILabel *labelAnswer2;
  IBOutlet UILabel *labelAnswer3;
  IBOutlet UILabel *labelScore;
  
  int score;    
  </code></pre>
  
  <p>} </p>
  
  <pre><code>@property (nonatomic, retain) IBOutlet UILabel *labelScore;
  @property (nonatomic) int score;
  
  
  ViewController.m
  
  @synthesize labelScore;
  @synthesize score;
  
  -(IBAction)CorrectAnswer; {
  
      score = score +1;
      labelScore.text = [NSString stringWithFormat:@"%i", score];
  
  }
  
  -(IBAction)WrongAnswer; {
  
      score = score -1;
      labelScore.text = [NSString stringWithFormat:@"%i", score];
  
  }
  </code></pre>