Hi,
I have a sqlite database similar to the Apple contacts app.
I do all the tricks I know to get a smoth operation, but I have a problem.
I load the data in 50 recods blocks. Then, when the user scroll, request next 50 until finish the list.
However, load that 50 records cause a notable "pause" in loading & scrolling. Everything else work fine.
I cache the data, have opaque cells, draw it by code, etc...
This is the code:
I wonder what to do. Maybe using a async loading? or threads?
No using objects and put the data in a array?
I have a sqlite database similar to the Apple contacts app.
I do all the tricks I know to get a smoth operation, but I have a problem.
I load the data in 50 recods blocks. Then, when the user scroll, request next 50 until finish the list.
However, load that 50 records cause a notable "pause" in loading & scrolling. Everything else work fine.
I cache the data, have opaque cells, draw it by code, etc...
This is the code:
//This load the records with LIMIT 50
NSArray *list = [db loadAndFill:sql theClass:[self returnItemClass]];
//This fill the biz objects. Here are the main wait...
-(NSArray *) loadAndFill: (NSString *)sql theClass: (Class)cls {
[self openDb];
NSMutableArray *list = [NSMutableArray array];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
id ds;
Class myClass = NSClassFromString([DbObject getTableName:cls]);
FMResultSet *rs = [self load:sql];
while ([rs next]) {
ds = [[myClass alloc] init];
[self fill:ds resultset:rs];
[list addObject :ds];
[ds release];
}
[rs close];
[pool drain];
return list;
}
I wonder what to do. Maybe using a async loading? or threads?
No using objects and put the data in a array?