Domanda

Suppose I fetched a string (0102030405, in hex) from the web service, then I need to parse it to localized names. For example: 01 will be parsed to name_1, and 02 will be parsed to name_2, etc, if the preferred language is English.

I want to store a string list file like this:

name_1
name_2
name_3
...(hundreds of)

I don't want to compile it, and what's more, it should be indexed.
But how can I archive this? Is that possible?

Thanks in advance!

È stato utile?

Soluzione

Finally, I found that .plist is really suitable!

Workaround:

Manually create a stringList.plist with array type, and while the app is first installed to the device, call a method to copy the plist file to Documents folder, so I can update it anytime without the requirement of updating the app.

Here're some links that help me a lot:

  1. Using iOS SDK to create a plist at runtime?
  2. Reading a plist into an NSArray
  3. Create Plist Programmatically

Thanks for the authors here. :)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top