简体   繁体   中英

iphone - save user data - sqlite

I have a situation where the user enters a screen and fills some data and when the user leaves the application or click save. I want to save the information. In most of the textfields the data is pre-populated from the Web service data.In one text field it has a UIpickerview from which user and choose an option. I am saving all the data in SQLite database. based on the date and time. Next time the user visits the saved screen i need to show the saved information. Now the data will be from the sqlite db and not web service. In this case how will show the UIPickerview data. Because only the user chosen data is saved in the DB. How can i solve this. Any help is appreciated.

Thanks

You are receiving data from web service in which you must be having some unique field. Store that field into the local database . When you load the screen compare that unique id received from the web to the local database . If that Unique ID is not available in local that means user is visiting first time otherwise not.

Hope it helps.

You have to know where is your UIPickerview data, to show all picker value.

And you can save your selected data with NSDictionary type(or object...), that has key selected(BOOL).

So next time you read data from DB, You have key to know what value you selected.

Hope it helps....

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