uitableview 中的 ios 进度条

标签 ios uitableview uiprogressbar

我是 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;
}

最佳答案

-(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];
      }
   }
}

我希望这个观点能够实现

关于uitableview 中的 ios 进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20122695/

相关文章:

ios - 在 iOS 9.3.1 中获取位置权限后应用程序崩溃

xml - 从 RSS 提要中读取图像,然后将其存储到 iPhone 应用程序中

swift - 为什么 UItableview 中单元格的宽度与模拟器中屏幕的宽度不同?

iphone - 核心数据实体为字典/plist

iphone - iOS : is it possible to open previous viewController after crashing and re-launch app?

ios - 当用户向 UITableView 添加行时,返回应用程序时新行不是 "stay"

ios - 带有 UIImageView 的自定义 UITableViewCell 为最后一个提供了错误的大小

ios - AVPlayer seekToTime : backward not working

iphone - UIProgressbar更新方法