[英]Change uilabel text after uiview is loaded
I have a custom UIView
subclass. 我有一个自定义的UIView
子类。 I am loading this through [[NSBundle mainBundle] loadNibNamed:@"" ...]
. 我正在通过[[NSBundle mainBundle] loadNibNamed:@"" ...]
加载此文件。 I have linked all of my outlets properly in Interface Builder but in initWithCoder
, my UILabel
is 0x0. 我已经在Interface Builder中正确链接了所有出口,但是在initWithCoder
,我的UILabel
是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
? 在哪里可以有一个方法在IBOutlets
完成初始化时将调用,以便可以访问UILabel
并调用setText
?
viewDidLoad, and don't forget to call super viewDidLoad,别忘了调用super
- (void)viewDidLoad
{
[super viewDidLoad];
mylabel.text = @"yadayadayada";
}
在控制器的-viewDidLoad
方法中初始化UI元素
Wow, found the answer! 哇,找到答案了!
- (void)awakeFromNib
Thanks to all that answered anyway! 多亏了所有回答!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.