tags:

views:

39

answers:

1

I am trying to use NSUser Deafault in my application user have tp fillup 4 UITextFields. I am trying to save the fields so that on subsequent runs of the program that whatever they previously put will already be displayed in those UITextFields so the wont have to re-input it in - unless they want to edit something in which case they still have that option. I think that I have figured out a good way to save the strings using NSUserDefaults but now I am trying to figure out how to have those fields populate a UITextField - it doesnt seem as easy as if they were UILabels. This is the route I am attempting:

Now my value is being saved in nsuserDefalut,but hot how to fetch dat value next time(when i re start application (null appear on the uitext field)) ..I am trying this cods

NSUserDefaults *userData = [NSUserDefaults standardUserDefaults]; //Hooks. NSString *placeHolderName = [userData stringForKey:@"name"]; urltextFieldNormal.text = placeHolderName;

+2  A: 

Do you remember to sync NSUserDefaults when you save the strings?

    [[NSUserDefaults standardUserDefaults] setObject:@"Hello mister nick" forKey:@"alarmsArray"];
    [[NSUserDefaults standardUserDefaults] synchronize];

Cheers mate...

objneodude
plz accept my questions plz coz whenever i ask any question regarding iPhone this msz appear on the screen "Sorry, we are no longer accepting questions from this account. "
talktobijju