2013-11-21 61 views
0

我是新来的ios如何更新uitableview中的进度条。一般来说,我有一个按钮,当我在一个特定的细胞点击一个按钮,我需要显示在该单元格仅显示进度条,请帮助我,在此先感谢ios进度条在uitableview中

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *simpleTableIdentifier = @"Categorycell"; 

    Categorycell *cell = (Categorycell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; 
    if (cell == nil) 
    { 
     NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"Categorycell" owner:self options:nil]; 
     cell = [nib objectAtIndex:0]; 
    } 
    [tableView setSeparatorColor:[UIColor clearColor]];- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *simpleTableIdentifier = @"Categorycell"; 

    Categorycell *cell = (Categorycell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; 
    if (cell == nil) 
    { 
     NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"Categorycell" owner:self options:nil]; 
     cell = [nib objectAtIndex:0]; 
    } 
    [tableView setSeparatorColor:[UIColor clearColor]]; 
    cell.selectionStyle=UITableViewCellSelectionStyleNone; 

    NSLog(@"Index : %d",indexPath.row); 
    NSString *str_filepath=[thumbnails objectAtIndex:indexPath.row]; 
    cell.cell_img.image=[[UIImage alloc]initWithContentsOfFile:str_filepath]; 

    cell.title.text=[arr_book objectAtIndex:indexPath.row]; 
    cell.sub_title.text=[arr_gen objectAtIndex:indexPath.row]; 
    NSString *str_rating=[arr_rating objectAtIndex:indexPath.row]; 
    int val_rating=[str_rating integerValue]; 

    // cell.cell_btn.hidden=YES; 

    cell.cell_btn.tag  = indexPath.row*10+1; 

    [cell.cell_btn addTarget:self action:@selector(btnDown:) forControlEvents:UIControlEventTouchUpInside]; 

    cell.cell_ReadBtn.tag  =indexPath.row*10+1; 
    [cell.cell_ReadBtn addTarget:self action:@selector(btnRead:) forControlEvents:UIControlEventTouchUpInside]; 

    cell.cell_Progress.tag= indexPath.row*10+1; 

    if(!bIspress) 
    { 
    cell.cell_Progress.hidden=YES; 
    } 
    NSString *comicbook_id = [arr_comic_id objectAtIndex:indexPath.row]; 
    NSString *filePath = [NSString stringWithFormat:@"book_%@.pdf",comicbook_id]; 
    NSLog(@"Book Name : %@",filePath); 
    if(![appDelegate check_Book_available:filePath]) 
    { 
     NSLog(@"Book Name Not : %@",filePath); 
    cell.cell_ReadBtn.hidden=YES; 
     cell.cell_btn.hidden= NO; 
    } 
    else 
    { 
     cell.cell_btn.hidden=YES; 
     cell.cell_ReadBtn.hidden=NO; 

    } 
    cell.tag=indexPath.row*10+1; 
    return cell; 
} 
+0

解释你想实现的目标,我的意思是单元格点击的进度如何发生 – Retro

+0

我只需要显示当我点击表格中的按钮。我需要显示这些单元格的progreess栏。我的意思是其实我隐藏进度条后点击按钮我需要显示进度条,它是请帮助我 – rakesh

+0

所以你的意思是你可以隐藏它,但无法显示,添加一些截图 – Retro

回答

1
-(void) btnDown:(id)sender { 
    UIButton* cellButton = (UIButton*)sender; 
    NSIndexPath* selectedIndexPath = [NSIndexPath indexPathForRow:cellButton.tag inSection:0]; 
    UITableViewCell* cell = [self.tableView cellForRowAtIndexPath:selectedIndexPath]; 

    for (id subView in cell.containView) { 
     if([subView isKindOfClass:[UIProgressView class]) { 
     UIProgressView * cellProgressView = (UIProgressView*)subView; 
     cellProgressView.frame = CGRectMake(10,10, 50,50); setYourFrame; 
     [cellProgressView setHidden:NO]; 
     } 
    } 
} 

我希望这个观点做