开发者

Where do I store the Notes if I want an "Add Note" function in my app

开发者 https://www.devze.com 2023-02-19 05:24 出处:网络
I want to add a simple note to my app. After searching, I found that I need: a tableView and the active Note\'s view \"please tell me if I\'m missing some thing\".

I want to add a simple note to my app. After searching, I found that I need: a tableView and the active Note's view "please tell me if I'm missing some thing".

What I couldn't find is How and Where to store the notes and how to r开发者_如何学运维etrieve it?

Thanks :)


For storing simple objects like strings for notes, take a look at NSUserDefaults.

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

[defaults setObject:@"hello" forKey:@"key"]; // Store value.

NSString *note = [defaults objectForKey:@"key"]; // Retrieve value.


Core data provides a good mechanism for persisting data that is more complex. Check out the guide here: Core Data.

0

精彩评论

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