开发者

How to change it back from activity indicator to disclosure in UITableViewCell after pushViewController

开发者 https://www.devze.com 2023-03-16 16:50 出处:网络
How to change it back from activity indicator to disclosure ?? the problem is: When i didSelectRow, i made disclosure to activity indicator because it will load some picture for the next view contro

How to change it back from activity indicator to disclosure ??

the problem is:

When i didSelectRow, i made disclosure to activity indicator because it will load some picture for the next view controller and It's worked, but i dont have any luck to change it back to disclosure after pushViewController. i already tried to reload the table from the 2ndViewController but it's crashed.

So anybody have a solution for this problem..

Thanks in advance

This is my code in 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 detachNewThrea开发者_开发问答dSelector:@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];


}


The best way is to set pointer nil to the accessoryView, example:

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

In my code these operations work fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号