0

助けてください。フレーム位置のアニメーションを UITableViewCell 内で動作させようとしています。具体的には、デフォルトの UILabel (cell.textLabel) を移動しようとしています。ただし、どのような手法を使用しても、セル内のビューを移動できません。色とアルファのアニメーションは、以下のコードで概説されているように機能します。

事前に乾杯して助けを求めてください。

アンディ

私が使用しているコードは次のとおりです。

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0 && indexPath.row == 0) {

        UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

        CGRect textLabelFrame = cell.textLabel.frame;
        textLabelFrame.origin.x = -textLabelFrame.size.width;

       [UIView animateWithDuration:0.5
            delay:0.0
            options:UIViewAnimationCurveEaseOut
            animations:^{
                cell.textLabel.frame = textLabelFrame; // THIS DOESN'T WORK - HELP!
                cell.imageView.frame = CGRectOffset(cell.imageView.frame,0,0); // EVEN TRYING TO MOVE IMAGEVIEW DOESN'T WORK
                cell.textLabel.alpha = 0; // This animates
                cell.imageView.backgroundColor = [UIColor redColor]; // This animates
            }
            completion:^(BOOL finished){
                NSLog(@"Done!");
        }];
    }
}
4

1 に答える 1

0

標準セルでデフォルトのラベルまたは画像ビューを再配置することはできないと思います。それを行いたい場合は、独自のサブビューをセルの contentView に追加し、それらでアニメーションを実行する必要があります。

于 2012-11-09T23:33:41.303 に答える