새 스레드가 연결되어 있고 해당 스레드에서 SQLite 쿼리를 실행 중입니다.스레드 쿼리에서 sql 쿼리가 실행될 때 테이블 뷰가 멈 춥니 다
문제는 모든 쿼리 실행이 끝날 때까지 테이블보기를 스크롤 할 수 없다는 것입니다. 몇 초 동결됩니다.
-(void)viewDidAppear:(BOOL)animated
{
[NSThread detachNewThreadSelector:@selector(GetBackEndData)
toTarget:appDelegate withObject:nil];
}
// this is in appDelegate
-(void)GetBackEndData
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if([dicBarnearMe_Detail count]==0)
{
// this are sql queries method.
[appDelegate SelectBeersonbottle_Count];
[appDelegate SelectBeersonTap_Count];
[appDelegate SelectGrowler_Count];
[appDelegate SelectHappyHours_Count];
[appDelegate SelectEvents_Count];
// After completing this process I'm post notification
// for reloading table in other controller.
[[NSNotificationCenter defaultCenter] postNotificationName:@"reload"
object:nil userInfo:nil];
}
[pool release];
}
우리가 SQL 쿼리 방법에 뭐가 있는지 보자 .... – Ankur
메인 스레드에서 뭐하고 있니? –
나는이 새로운 스레드 라인과 그 작업에 대해 논평하려 노력했다. 그래서 문제는 SQL 쿼리 실행을 수행하는 새로운 쓰레드를 붙이는 것이다. 메인 스레드에서 테이블을 다시로드하는 중입니다. – ruyamonis346