zsniperx
zsniperx

Reputation: 2742

Change uilabel text after uiview is loaded

I have a custom UIView subclass. I am loading this through [[NSBundle mainBundle] loadNibNamed:@"" ...]. I have linked all of my outlets properly in Interface Builder but in initWithCoder, my UILabel is 0x0.

Where can I have a method that will call when the IBOutlets will finish initalizing so I can access my UILabel and call setText?

Upvotes: 1

Views: 867

Answers (3)

zsniperx
zsniperx

Reputation: 2742

Wow, found the answer!

- (void)awakeFromNib

Thanks to all that answered anyway!

Upvotes: 0

Vladimir
Vladimir

Reputation: 170849

Initialize you UI elements in controller's -viewDidLoad method

Upvotes: 0

Colin
Colin

Reputation: 3752

viewDidLoad, and don't forget to call super

- (void)viewDidLoad
{
   [super viewDidLoad];
   mylabel.text = @"yadayadayada";
}

Upvotes: 1

Related Questions