开发者

How to set a default value to a UITextField when the application is loaded?

开发者 https://www.devze.com 2022-12-17 23:21 出处:网络
I\'m a Objective-C newbie and I\'m 开发者_运维技巧currently trying to build an app which has a UITextField (called \"initial_dose\") and I\'m wondering how can I set a default value which will be visi

I'm a Objective-C newbie and I'm 开发者_运维技巧currently trying to build an app which has a UITextField (called "initial_dose") and I'm wondering how can I set a default value which will be visible straight after the application is loaded.

I kind of know how to set the value but not sure where I need to call this?

initial_dose.text = "@myInitialVal";

Thanks a lot in advance!


Yes, in :

- (void)viewDidLoad {
    [super viewDidLoad];

    initial_dose.text = @"myInitialVal";
}

Which should I use, -awakeFromNib or -viewDidLoad? - for more info.

0

精彩评论

暂无评论...
验证码 换一张
取 消