title: iPhone: Access a NSString value from another class
body: <p>First let me apologise for my bad english. So I has trying to do this program that fetch the value of a NSString in one class from another class. Here's the code:</p>
  
  <pre><code>/---------------------/tableViewController.h -----------
  
  #import &lt;UIKit/UIKit.h&gt;
  @class paisesDetailViewController;
  
  @interface tableViewController : UITableViewController &lt;UITableViewDelegate, UITableViewDataSource&gt;{
      IBOutlet UITableView *paisesTableView;
      paisesDetailViewController *PaisesDetailViewController;
  
      //DB
      NSString *DBName;
      NSString *DBPath;
      NSMutableArray *ArrayPais; //means Countrys
      NSString *escolha; //means choise 
  }
  
  @property(nonatomic, retain) paisesDetailViewController *PaisesDetailViewController;
  @property(nonatomic, retain) NSMutableArray *ArrayPais;
  @property(nonatomic, retain) NSString *escolha;
  
  @end
  
  
  
  
  -----------------------------//tableViewController.m---------------
  
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
     NSInteger row = [indexPath row];
      if(self.PaisesDetailViewController == nil)
      {
          paisesDetailViewController *apaisesDetail = [[paisesDetailViewController alloc] initWithNibName:@"paisesDetailView" bundle:nil];
          self.PaisesDetailViewController = apaisesDetail;
          [apaisesDetail release];
      }
  
      [tableView deselectRowAtIndexPath:indexPath animated:YES];
  
      escolha = [[NSString alloc] init];
      self.escolha = [NSString stringWithFormat:@"%@", [ArrayPais objectAtIndex:(row)]]; 
  
      paisesDetailViewController *nextview = [[paisesDetailViewController alloc] init];
      [self.navigationController pushViewController:nextview animated:YES];
      [nextview release];
  
  }
  
  
  
  
  -----------------------------------//paisesDetailViewController.h------------
  #import &lt;UIKit/UIKit.h&gt;
  #import "tableViewController.h"
  @class tableViewController;
  
  @interface paisesDetailViewController : UIViewController {
      tableViewController *dados;
  
  }
  
  @property(nonatomic, retain) tableViewController *dados;
  
  @end
  
  
  //-----------------------paisesDetailViewController.m
  #import "paisesDetailViewController.h"
  #import "tableViewController.h"
  
  @implementation paisesDetailViewController
  @synthesize dados;
  
  -(IBAction) createEvent
  {
          NSString *help = [[NSString alloc] initWithString: dados.escolha]; 
  }
  </code></pre>
  
  <p>The problem is that the 'dados.escolha' is always nil and I just can't understand why.
  Thanks for the help.</p>