【发布时间】:2013-08-29 16:07:18
【问题描述】:
我有一个表每两秒刷新一次。 它在模拟器和我的 wifi 上运行良好。但是一旦我切换到蜂窝网络(或任何慢速网络),我就无法可靠地选择行。
有时当我单击一行时,它会在 8 秒后起作用。有时永远不会。
我以为是我的刷新函数导致了延迟,但我在函数的开头和结尾打印了时间,它只需要 2 毫秒。
有没有人遇到过类似的网络慢问题?关于可能是什么原因导致挂断的任何提示?
我的刷新函数是在viewDidLoad中调用的:
//Set timer to call refresh function every two seconds
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(updateMethod) userInfo:nil repeats:YES];
我的更新方法是:
- (void) updateMethod
{
[columnArray removeAllObjects];
[self getColumnData];
[homeTable reloadData];
}
getColumnData 调用网站并将数据放入 columnArray
【问题讨论】:
-
你的 didselectrowatindexpath 是否调用了“刷新”函数?
-
我编辑了我的问题作为回应 - 它在 viewDidLoad 中调用
-
你能发布'updateMethod'
-
你是在主队列上执行网络操作吗?如果是这样,您必须将网络操作移至后台队列,并且仅在网络操作完成/出错时更新主队列中的 UI。
-
我想我正在使用主队列。如何将网络操作移至后台队列?
标签: ios performance uitableview didselectrowatindexpath