Change the text of a UILabel in viewDidLoad() programmatically

Posted by HelloWorld on Stack Overflow See other posts from Stack Overflow or by HelloWorld
Published on 2010-03-24T03:00:49Z Indexed on 2010/03/24 3:03 UTC
Read the original article Hit count: 440

Filed under:
|

Hi everybody. I'm a beginneri iPhone developer. My code is the following:

   - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        displayLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 20, 230, 40)];
        [self.view addSubview:displayLabel];
    }
    return self;
   }

//
- (void)viewDidLoad {
    [super viewDidLoad];
    displayLabel.text = @"abc";
}

I want to change the label text in viewDidLoad methond,but it can't change label text.

I hope i explained my scenario. Sorry for my English. Greetings, dy.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uilabel