views:

96

answers:

1

Hi,

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!

+1  A: 

Yes, in :

- (void)viewDidLoad {
    [super viewDidLoad];

    initial_dose.text = @"myInitialVal";
}

http://stackoverflow.com/questions/377202/which-should-i-use-awakefromnib-or-viewdidload - for more info.

Mr-sk
Hi Mr-sk, I've just tested your suggestion and the app crash :-\The app is REALLY simple, it has two UITextField and a button.IBOutlet UITextField *pth_level;IBOutlet UITextField *initial_dose;I related each one through the connection panel (Interface Builder) with the File's Owner reference and that's it.Am I missing something? Thank you!!
Teknotica
I figured it out! thanks for that :)
Teknotica
Hey, cool man! No problem
Mr-sk
Actually I'm a girl ^^ lol
Teknotica
heh sorry, "hey cool girl!" heh
Mr-sk