简体   繁体   中英

How do I save a table view's data in my app?

I created an app where you edit a table with an "activity" and set a "time" for the activity.

I want the data to be stored in the app so that when the user opens up the app again all the activities are still there.

How do I save all that data so it's still there once the app is reopened?

You need to use Coredata . There some great tutorials in the Internet (like this one here ) that can help you.

You can use CoreData or SQLite . But from my experience, when I came accross Realm , I was literally stunned.

Realm

Realm is a replacement for SQLite & Core Data. It can save you thousands of lines of code & weeks of work, and lets you craft amazing new user experiences.

It is really simple and powerfull to use, and actually way faster than CoreData. You can create a database and read/save data from it in just a couple of lines of code, in constrast of CoreData.

There are also lots of tutorials and a great documentation.

I started using Realm in every app, either bussines or free-time apps.

You can get it here: https://realm.io/

Like the others said core data is the way to go on this, its rather simple to use but if you still don't feel comfortable with it you will need to store it in some sort of data base so that when you change/edit or add some sort of information to a users account it will stay. If that isn't enough check out NSUserDefaults!

Have a good day!

If the data is not too long you can use NSUserDefaults, actually this class is recommended for storing setting data or something like favorites etc.. but you can start from it.

Now if what you are planning is a huge data storage, maybe a lot of entries, lots of keys and in general a lot of DATA I strongly recommend you to use CORE DATA, there are a lot of tutorials, they are even books about core data so you need to do a lot of research.

And a combination of both I think, It could be Parse this service could help you not only with local storage, you can start a free remote storage with plenty of space and request to begin with your tests....

Here you have a local Parse DataBase loaded into an UITableview's

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