José María
José María

Reputation: 3073

Data log with Table View

I'm creating a simple app that allows users to see how much money they have earned or spent. You click a button to add money and click other to withdraw money. App itself

I want to add a log to the app where the user can see when he spent money or earned money. So for example:

January 4th 18:50 -> +30€ January 4th 19:34 -> -67€

How would you do that? I mean, how could I get that data out and present it on a table view. I'm not asking for the code (that's the fun!) I'm asking the ideas, the concepts for making it. Thank you!

Upvotes: 0

Views: 175

Answers (1)

Lorenzo B
Lorenzo B

Reputation: 33428

For such type of task I would use Core Data framework . Out there, especially in Ray Wenderlich site there a lot of tuts about Core Data. In particular, I would use a NSFecthedResultsController that can be used with UITableView to show user logs. The fetched controller allows you to lazy loading rows and so to maintain a low memory footprint. Especially if logs become huge.

Obviously Core Data has a deep learning curve, so if you don't want to spend time for it, you could also use plain Sqlite wrapping it through FMDB. Or just use a plist file where you should write log.

About the formatting, I guess you have all the info to print what you want. If you have a plain text file, you should write the log as is. On the contrary, if you use Core Data/Sqlite, you should think to the attributes/columns you need.

Upvotes: 1

Related Questions