I have a simple lookup table, which consists of the following structure:
int | string
- given an int, I want to return a string. However I have to use a lookup table as there is no correlation between the int and the string.
What is the most efficient and fastest way to implement this on the iPhone in Objective-C?
E.g.
// However will 200k values take too long to load and take up too much memory? NSString *value = [lookupTable objectForKey:[NSNumber numberWithInt:key]]开发者_开发知识库Without knowing how large your strings are, you should almost certainly be looking at coredata for this sort of thing. It'll work a treat for those sort of numbers and will keep your memory footprint low.
There's quite a nice coredata tutorial here and of course copious Apple documentation
精彩评论