2013-11-21 1 views
0

Я новичок в ios, как обновить индикатор выполнения в uitableview. в общем я кнопка, при нажатии кнопки в определенной ячейке мне нужно показать прогресс бар в этой ячейке только пожалуйста, помогите мне и спасибо заранееios progress bar в 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

. Мне просто нужно показать, когда я нажимаю кнопку в tablecell. Мне нужно показать progreess бар этих cell.i на самом деле я скрываю индикатор прогресса после нажатия кнопки мне нужно показать progressbar, что это, пожалуйста, помогите мне – 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]; 
     } 
    } 
} 

Я надеюсь, что этот вид сделать