title: How to change text of a button when another button is pressed in a different view
body: <p>In my project I am trying to count the number of rows selected and then when I press the button it goes to the previous view and the button text in that view should change to how many rows are selected. I realize I must be making a simple mistake, but can't figure it out. I would appreciate some help with this. </p>
  
  <p>Here is the code I am using in the .m file:</p>
  
  <pre><code>- (IBAction)doneButton:(id)sender
  {
      appDelegate = (AppDelegate*) [[UIApplication sharedApplication] delegate];
      CountryModel *countryModel = [[CountryModel alloc]init];
  
      CompareViewController *compareViewController = [[CompareViewController alloc]init];
  
          [compareViewController. addCountries setTitle:[NSString stringWithFormat:@"%ld Countries Selected", countId] forState:(UIControlState)UIControlStateNormal];
          NSLog(@"%ld",countId);
  //    compareViewController.addCountries.titleLabel.text = [NSString stringWithFormat:@"%ld Countries Selected", countId];
      compareViewController.Cid = countryModel.Id;
      [self.navigationController pushViewController:compareViewController animated:YES];
  }
  </code></pre>
  
  <p>And here is the .h code for CompareViewController:</p>
  
  <pre><code>@interface CompareViewController : UIViewController
  
  @property (assign) NSInteger Cid;
  - (IBAction)addRemoveCountries:(id)sender;
  @property (weak, nonatomic) IBOutlet UIButton *addCountries;
  </code></pre>