【发布时间】:2013-12-23 10:32:39
【问题描述】:
我是一个初学者,我实际上是在显示一个带有单元格的表格视图,当我们点击表格视图单元格时,会发生解析并且在解析活动指示器动画期间。但是当我尝试这样做时,第一次点击活动指示器没有显示,当我选择另一个单元格时第一次点击后它开始工作。为什么会发生这种情况?我在 didSelectRowAtIndexPath 中编写我的代码。这里 [self xmlParsing] 是我的解析函数。那么如何解决这个问题呢?请帮忙。
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell= [tableView cellForRowAtIndexPath:indexPath];
if(cell.accessoryView==nil)
if (indexPath.row==0)
{
[parseArray removeAllObjects];
[self.view addSubview:activityIndicator];
[NSThread detachNewThreadSelector:@selector(threadStartAnimating:) toTarget:self withObject:nil];
[self xmlParsing];
[activityIndicator stopAnimating];
}
if (indexPath.row==1)
{
[parseArray removeAllObjects];
[self.view addSubview:activityIndicator];
[NSThread detachNewThreadSelector:@selector(threadStartAnimating:) toTarget:self withObject:nil];
[self xmlParsing];
[activityIndicator stopAnimating];
}
if (indexPath.row==2)
{
[parseArray removeAllObjects];
[self.view addSubview:activityIndicator];
[NSThread detachNewThreadSelector:@selector(threadStartAnimating:) toTarget:self withObject:nil];
[self xmlParsing];
[activityIndicator stopAnimating];
}
}
【问题讨论】:
标签: ios uitableview uiactivityindicatorview