我在iPhone上使用标准导航器界面。当我从最高级别的tableview移动到下一个级别时,我必须从核心数据加载大约2000条记录,这可能需要5-10秒,所以我想使用活动指标。活动指示灯未显示在iPhone上
我也做了下面的代码,如果我在DidSelect方法删除代码的工作,但从未否则会出现指示,即使观点仍在等待那里,而另一种观点认为负载。以下是方法:
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
//-- start activity indicator (will be stopped when view disappears)
UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
[cell.contentView addSubview:m_activityIndicator];
[m_activityIndicator startAnimating];
return indexPath;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//--show the listViewController
CardListViewController *listViewController = [[CardListViewController alloc] initWithNibName:@"CardListViewController" bundle:nil];
NSString* selectedCardTypeName = [rootSelectionList objectAtIndex:indexPath.row];
enum CardTypes selectedCardType = cardTypeIDFromCardTypeName(selectedCardTypeName);
listViewController.selectedCardType =selectedCardType;
[self.navigationController pushViewController:listViewController animated:YES];
[listViewController release];
}
如何在开始处理下一个listviewcontroller之前强制显示活动指示符?
可惜setNeedsDisplay没有工作,但我很感兴趣关于表的延迟加载的建议。 在我读这个例子之前,如果它是一个带有搜索功能的索引表,它会非常复杂吗? – WaterBoy 2010-08-27 03:36:40
你不需要注意索引或搜索。对于你的情况,你可以考虑你将只有一个部分,并忘记搜索。你应该真正理解的是为什么和在哪里调用[self loadImagesForOnscreenRows];那就是延迟加载完成的地方。 – vfn 2010-08-27 04:09:29
我当时一看,但我不认为我有把所有的记录,其用于填充我的索引列表的tableview“名字”这将有利于我。如果我得到这个名字,我不妨得到完整的记录。 – WaterBoy 2010-08-27 05:56:27