简体   繁体   中英

NSUserDefault in Xcode

I have a question on how can i use core date to update my formula. I have tried using NSUserDefault but the formula is blank (its saves though). So I have two textfields which needs to update my formula. And when the user quits the app the two textfield date needs to be saved. So how should I approach this way…..

Saving the content of a text field to the user defaults:

[[NSUserDefaults standardUserDefaults] setObject:field1.text forKey:@"field1"];
[[NSUserDefaults standardUserDefaults] synchronize];

Loading the content of a text field from the user defaults:

[[NSUserDefaults standardUserDefaults] synchronize];
field1.text = [[NSUserDefaults standardUserDefaults] stringForKey:@"field1"];

CoreDat has little to do with saving simple things like that. 与保存这样的简单事情几乎没有关系。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM