开发者

textfield content in an iphone

As iam new the iphone development, i had created some textfields ,on click of save button it gets saved to a xml file ,and get disappears in the text field.On the next login, how to get the previously entered data in the same text field,so that i can modif开发者_StackOverflowy the same data entered in the previous log in

thank you in advance


Read the xml file and set this to the textfield, textfield.text = @"your String";


To get previously entered data, you have to save them. For this when user tap on save button you can save the value of each text field to NSUserDefaults for a key and when you want to get data you can get for that key.

To save-

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

[defaults setObject:[textfield text] forKey:@"username"];

To get -

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

NSString *str = [defaults objectForKey:@"username"];

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜