我有一个简单的UITableView应用程序,它有一个SQLITE数据库(大约有20000行),由于每次选择需要大约3-6秒来获取结果,所以我想在用户触摸单元格行时显示一个进度条,这样他就知道发生了什么。
我试过了,但效果不好,因为HUD只出现了大约0.1秒:
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
HUD = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
HUD.mode = MBProgressHUDModeIndeterminate;
HUD.labelText = @"Loading";
return indexPath;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
...
[HUD hide:YES afterDelay:0.1];
}提前感谢您的帮助!
发布于 2012-04-13 01:27:41
你可以在单元格附件中添加一个UIActivity指示器,而不是添加进度条。它很容易创建,在外观上也很好用。
https://stackoverflow.com/questions/10127795
复制相似问题