I use some code as below to prepare list for my table view, it is very slow, is there any faster way to make list?
Code:
-(BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
NSBundle *bundle = [NSBundle mainBundle];
NSString *filePath = [bundle pathForResource:@"index" ofType:@"txt"];
NSString *contents = [NSString stringWithContentsOfFile:filePath encoding:NSShiftJISStringEncoding error:nil];
NSArray *list = [contents componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
int i = 0;
if (list) {
NSMutableArray *stock = [[NSMutableArray alloc] init];
for (NSString *item in list) {
if ([item length] != 0 && i != 0) {
NSRange obs = [item rangeOfString:@"OBS"];
if (obs.location == NSNotFound) {
obs = [item rangeOfString:@"A100"];
if (obs.location == NSNotFound) {
[stock addObject:item];
}
}
}
i++;
}
stockSplit = stock;
}
}