如何在pushViewController之后将其从活动指示器更改回UITableViewCell中的公开内容

时间:2011-07-01 23:39:46

标签: xcode uitableview uiviewcontroller uiactivityindicatorview activity-indicator

如何将其从活动指标更改为披露?

问题是:

当我做了SelectRow时,我向活动指示器做了披露,因为它会为下一个视图控制器加载一些图片并且它工作正常,但我没有任何运气将它改回到pushViewController之后的披露。我已经尝试从2ndViewController重新加载表,但它已经崩溃了。

所以任何人都有解决这个问题的方法..

提前致谢

这是我在didSelectRow中的代码:

-(void)threadStartAnimating:(id)data  
{  


    [activityView startAnimating]; 

    [self.navigationController pushViewController:bdvController  animated:YES];




}  

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    [cell setAccessoryView:activityView]; 




    [NSThread detachNewThreadSelector:@selector(threadStartAnimating:) toTarget:self withObject:nil];  





    // Navigation logic -- create and push a new view controller
    if(bdvController == nil)

        bdvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];


    AppRecord *appRecord = [self.entries objectAtIndex:indexPath.row];




    bdvController.appsRecord = appRecord;
   bdvController.HeaderText.text = appRecord.appName;
     bdvController.title = appRecord.artist;
    [bdvController.tableView reloadData];


}

1 个答案:

答案 0 :(得分:2)

最好的方法是将指针nil设置为accessoryView,例如:

cell.accessoryView = nil;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
cell.selectionStyle = UITableViewCellSelectionStyleGray;

在我的代码中,这些操作运行正常。