0

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!

DD_
  • 7,230
  • 11
  • 38
  • 59
Teknotica
  • 1,096
  • 6
  • 19

1 Answers1

3

Yes, in :

- (void)viewDidLoad {
    [super viewDidLoad];

    initial_dose.text = @"myInitialVal";
}

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

Community
  • 1
  • 1
mr-sk
  • 13,174
  • 11
  • 66
  • 101
  • 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 Jan 19 '10 at 16:52