title: Problem with passing string with a function
body: <p>Hey everbody, im getting some trouble here. Well, im trying to pass a value from an string to an label. Im setting to setText:myString inside of function, but doesnt works. But when i try to set some random text inside of viewDidLoad, it works.</p>
  
  <p>My function is called inside of viewDidLoad.</p>
  
  <pre><code>    - (void)viewDidLoad {
          //this works
          [precoProd setText:@"hahaha"];
          //here not
          [MyViewClassName print];
          [super viewDidLoad];
      }
     -(void) print{
  
          float x = 500;
          float c = x/3;
  
          NSString *valorTotalParcelas;
  
          if(c &gt; 0) {
              NSString *pVal = [NSString stringWithFormat:@"%0.2f", c];
              NSString *cents = [pVal substringFromIndex:2];
              NSString *reais = [pVal substringWithRange:NSMakeRange(0, 1)];
  
              valorTotalParcelas = [[NSString alloc] initWithFormat:@"%@,%@",reais, cents];
  
  
          }
          // ---------------------
          if(c &gt; 9.99) {
              NSString *pVal = [NSString stringWithFormat:@"%0.2f", c];
              NSString *cents = [pVal substringFromIndex:3];
              NSString *reais = [pVal substringWithRange:NSMakeRange(0, 2)];
  
              valorTotalParcelas = [[NSString alloc] initWithFormat:@"%@,%@",reais, cents];
  
          }
          // ---------------------
          if(c &gt; 99.99) {
              NSString *pVal = [NSString stringWithFormat:@"%0.2f", c];
              NSString *cents = [pVal substringFromIndex:4];
              NSString *reais = [pVal substringWithRange:NSMakeRange(0, 3)];
  
              valorTotalParcelas= [[NSString alloc] initWithFormat:@"%@,%@",reais, cents];
  
          }
          // ---------------------
          if(c &gt; 999.99) {
              NSString *pVal = [NSString stringWithFormat:@"%0.2f", c];
              NSString *cents = [pVal substringFromIndex:5];
              NSString *reais = [pVal substringWithRange:NSMakeRange(0, 4)];
  
              valorTotalParcelas = [[NSString alloc] initWithFormat:@"%@,%@",reais, cents];
  
          }
  
          NSLog(@"FINAL VALUE ---&gt; %@", valorTotalParcelas);
          [precoProd setText:valorTotalParcelas];
  
      }
  </code></pre>
  
  <p>What im doing wrong? Thanks!</p>