ResourceString file equivalent on iOS
So here is the whole story. I have done alot of code for a lot of platforms. I really like the concept that I have found in Java and .NET with a resource file that can contain all the strings you will use in your app. Hopefully some of you know about it. It's basically an XML file sorted in a key=>value kind of way. I have been looking for an equivalent in iOS but I'm unclear. There is infoPlist.strings, but that seems like the wrong path. I may be wrong.
So what we want is, we have a whole bunch of strings that get repeated in multiple places (alert boxes, direction text, etc.). We need that to be a change once kind of experience. There are multiple ways of doing this, I开发者_StackOverflow中文版 just don't know which one is the best.
I'm not really eloquent, so if anyone has questions or needs clarification, let me know.
If localization is not what you are trying to do, then you could just put them in a dictionary in a plist file. Have your app read the plist file at app startup and store in a global variable or some singleton that can be easily referenced throughout your app.
This is handled by the localization system. Look at NSLocalizedString()
and Localizing String Resources. It should do exactly what you are looking for.
精彩评论