开发者

best way of storing a list of words in iOS

开发者 https://www.devze.com 2023-03-24 06:00 出处:网络
So I have an app that needs to take a local data (persistence) , which is basically a list of words, it is categorized into three categories.. in other words, technically speaking I would have 3 .txt

So I have an app that needs to take a local data (persistence) , which is basically a list of words, it is categorized into three categories.. in other words, technically speaking I would have 3 .txt file list of words that I would like to make it available in my app.

What is the best way to do this? There are many options in doing this, such as using core data (which I think might be an overkill) or NSUserDefaults, or a.plist. I can create 3 separate .plist file. Talking about how it will be used, I will have a UISegmentedControl with 3 tabs (representing the 3 txt file of words I have). I would like then to choose a random word from the list associated with the segment. Needed some advice a开发者_如何学Gond input on this. Thanks

UPDATE:

Sorry I forgot to mention how many words approximately in a file, there are approximately 100 to 200 max of words in a file


It sounds like plists would be the way to go. Some of this would depend on how long the lists are and if they are changing or not. Plists are easy and fast.


Also you can use sqlite in addition to the ways you have mentioned.

Better You can use plists.

Reading and writing to plists have been explained well here.

0

精彩评论

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

关注公众号