2
我附加了一个新线程,并且在该线程中,我发射了5个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 2012-02-08 13:28:49
你在主线程上做什么? – 2012-02-08 13:35:52
我已经尝试评论这个新的线程和它的工作正常。所以,问题是附加执行sql查询执行的新线程。在主线上我只是重新加载表。 – ruyamonis346 2012-02-09 10:14:46