title: @protocol with integers
body: <p>I am trying to make a protocol for a detail view for a tableView. The detail view has a question and then an answer. If I get the answer correct, it will set an integer to <em>increase</em>  by 1 in a protocol method.</p>
  
  <p>I am new to protocols and I don't understand what I am doing wrong.</p>
  
  <h1>Code</h1>
  
  <h2>DetailViewController.h</h2>
  
  <h3>Where the protocol is made</h3>
  
  <pre><code>#import "Question.h"
  
  @protocol DetailQuestionViewControllerDelegate &lt;NSObject&gt;
  -(void)questionsCorrectHasChangedTo:(int)questionNumberChanged;
  @end
  
  @interface DetailQuestionViewController : UIViewController
  
  @property (nonatomic, strong) Question *selectedQuestion;
  
  @property (strong, nonatomic) IBOutlet UILabel *questionLabel;
  @property (strong, nonatomic) IBOutlet UITextField *answerField;
  @property (strong, nonatomic) IBOutlet UILabel *correctLabel;
  @property (nonatomic,strong) id &lt;DetailQuestionViewControllerDelegate&gt; delegate;
  
  @property (assign, nonatomic) int questionsCorrect;
  </code></pre>
  
  <h2>DetailViewController.m</h2>
  
  <pre><code>@implementation DetailQuestionViewController
  
  @synthesize questionLabel;
  @synthesize answerField;
  @synthesize correctLabel;
  @synthesize selectedQuestion;
  @synthesize questionsCorrect;
  @synthesize delegate;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
  
      // Sets the questionLabel to the question we put in the array
      self.questionLabel.text = [selectedQuestion questionName]; 
  
      // Sets the navigation title to the rowName we put in the array
      self.navigationItem.title = [selectedQuestion questionRowName]; 
  
     NSLog(@"The question's answer for the question you selected is %@", [selectedQuestion questionAnswer]);
  
  
  }
  
  - (IBAction)checkAnswer:(UITextField *)sender
  {
  
      if ([[selectedQuestion questionAnswer] caseInsensitiveCompare:answerField.text] == NSOrderedSame)
      {
          // Show the  correct label
          [correctLabel setHidden:NO];
          correctLabel.text = @"Correct!";
          correctLabel.textColor = [UIColor greenColor];
          *questionsCorrect = 1;
          NSLog(@"questionsCorrect int is %d", questionsCorrect);
          [self.delegate questionsCorrectHasChangedTo:questionsCorrect];*
  
      }
          else
          {
              // Show the incorrect label
              [correctLabel setHidden:NO];
              correctLabel.text = @"Incorrect";
              correctLabel.textColor = [UIColor redColor];
  
          }
  
          // Erase the text in the answerField
          answerField.text = @"";
  }
  </code></pre>
  
  <h2>ScoreViewController.h</h2>
  
  <h3>Now here is my ScoreView which will be acsessing the delegate</h3>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "DetailQuestionViewController.h"
  
  @interface ScoreViewController : UIViewController *&lt;DetailQuestionViewControllerDelegate&gt;*
  
  
  @property (strong, nonatomic) IBOutlet UILabel *scoreLabel;
  
  - (IBAction)resetButtonClicked:(UIButton *)sender;
  -(void)checkScore;
  
  @end
  </code></pre>
  
  <h2>ScoreViewController.m</h2>
  
  <pre><code>#import "ScoreViewController.h"
  #import "DetailQuestionViewController.h"
  
  @interface ScoreViewController ()
  
  @end
  
  @implementation ScoreViewController
  @synthesize scoreLabel;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
  
      *DetailQuestionViewController *dqvc = [[DetailQuestionViewController alloc] init];
      dqvc.delegate = self;*
  
  }
  
  -(void)viewWillAppear:(BOOL)animated
  {
  
      [self checkScore];
  
  }
  
  -(void)checkScore
  {
  
  }
  
  - (IBAction)resetButtonClicked:(UIButton *)sender
  {
  
  }
  
  #pragma mark - DetailQuestionViewControllerDelegate -
  *-(void)questionsCorrectHasChangedTo:(int)questionNumberChanged*
  {
      //set the textlabel text value to the number of questions correct
      NSLog(@"questionsNumberChanged is %i", questionNumberChanged);
      scoreLabel.text = [NSString stringWithFormat:@"You answered %d questions correctly",questionNumberChanged];
  }
  
  @end
  </code></pre>
  
  <p>The label is never updating for some reason.</p>
  
  <p>Sorry for making the question so long, tried to be very specific.</p>