2

サブクラス化UITableViewCellされた custom があり、そこに進行状況ビューを挿入しています。

方法は次のとおりです。

-(void)layoutSubviews {
    applicationDelegate = [[UIApplication sharedApplication] delegate];
    [super layoutSubviews];
    self.imageView.frame = CGRectMake(0, 0, self.frame.size.height, self.frame.size.height);

        self.textLabel.frame = CGRectMake( self.imageView.frame.size.width + 20, self.textLabel.frame.origin.y, self.textLabel.frame.size.width, self.textLabel.frame.size.height);
        progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
        progressView.frame = CGRectMake(self.textLabel.frame.origin.x, 50, 150, 100);
        progressView.progress = 0.0f;
        progressView.trackTintColor = [UIColor clearColor];
        progressView.progressTintColor = [UIColor redColor];
        progressView.tag = 101;
        [progressView setHidden:YES];
        [self.contentView addSubview:progressView];
}

今、他のView Controllerでこの要素を最初のセルにのみ表示したいので、これらの要素を他のセルで非表示にしようとしています。メソッドでこれを行うcellForRowAtIndexPath:方法は次のとおりです。

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString * cellIdentifier = @"cellId";

    CustomCell * cell = [self.tableview dequeueReusableHeaderFooterViewWithIdentifier:cellIdentifier];

    if (cell == Nil) {

        cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
    }

if (indexPath.row == 0) {

            imageData = UIImageJPEGRepresentation(cell.imageView.image, 100);
            filename = cell.textLabel.text;

            [(UIProgressView*)[cell.contentView viewWithTag:101] setHidden:NO];<==Not Working
}

    return cell;
}

ViewController のカスタム UITableView サブクラスでこの UIElements を使用するにはどうすればよいですか? 私は xib ファイルを使用していません。すべてがプログラムで行われます。私はこれで一日中遊んでいますが、ここに何か考えがある人はいますか?

4

1 に答える 1