objective c - Where to put several hundred array declarations for best performance in iOS? -


i have need 2-dimensional look-up table app. wanted possible, made series of arrays, , call appropriate array , position within array whenever needed. however, takes 500 arrays... here code snippet:

 nsarray *key_1 = [[nsarray alloc] initwithobjects:@"1",@"0.5038",@"0.8054",@"4.51",nil];  nsarray *key_2 = [[nsarray alloc] initwithobjects:@"1",@"0.4869",@"0.8009",@"4.7",nil];  nsarray *key_3 = [[nsarray alloc] initwithobjects:@"1",@"0.4708",@"0.7967",@"4.9",nil];  nsarray *key_4 = [[nsarray alloc] initwithobjects:@"1",@"0.4554",@"0.7926",@"5.09",nil];  nsarray *key_5 = [[nsarray alloc] initwithobjects:@"1",@"0.4407",@"0.7889",@"5.27",nil];  nsarray *key_6 = [[nsarray alloc] initwithobjects:@"1",@"0.426",@"0.7853",@"5.46",nil];  nsarray *key_7 = [[nsarray alloc] initwithobjects:@"1",@"0.4133",@"0.7819",@"5.65",nil]; 

however, have 2 concerns. first, if these 500 array declarations cause momentary hang in app, should put code executes while still on app's splash screen when first starting up? in viewwillappear?

second (and more of newb question), if place these array declarations in viewwillappear or other method in firstviewcontroller.m, how can make them accessible methods in secondviewcontroller.m?

thanks!

so have 2 options

first: can load these arrays on different thread (not on main thread). can use gcd create new thread , pass these array blocks work on. doing can solve first problem "momentary hang".

second: mrunal mentioned "try using plist files this. write data in in dictionary format (key-value). , fetch required data using specific key."

i option number 2 if have dynamic array please use option number one.


Comments