UiLabeltext not changing !!!!

Discussion in 'iOS Programming' started by pragyanshis, Sep 27, 2011.

  1. pragyanshis macrumors newbie

    Sep 27, 2011
    I have defined a function in appdelegate like below.

    - (void) ChangeLabelText:(NSString *)SenderP
    TeenTaalViewControllerM = [[TeenTaalViewController alloc] initWithNibName:@"TeenTaalViewController" bundle:nil]; 
    TeenTaalViewControllerM.view.hidden= NO;
    [self.TeenTaalViewControllerM.lblLoopCountM setText:SenderP]; 
    self.TeenTaalViewControllerM.lblLoopCountM.hidden = NO; 
    and I am calling this function from a class like below

    TeenTaalAppDelegate * TheAppDelegateL = [[UIApplication sharedApplication] delegate];
    [TheAppDelegateL ChangeLabelText:@"Test"]; 

    But the text of the UIlabel is not changing anyway !!!!please help !!!
  2. jnoxx macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    You are creating a NEW instance of your TeenTaalViewControllerM class. This will result in the label on your view the first time, and the label you are trying to assign will have 2 different memory adresses. This will result, in you maybe setting the label, but the wrong one behind the scenes ;)
  3. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    What happens when you log TeenTaalViewControllerM.view in that method? Then try to think about why you get this result.

Share This Page