簡體   English   中英

UITableView WillDisplayCell方法在特定時間后調用?

[英]UITableView WillDisplayCell Method call after particular time?

我試圖將動畫放在UITableViewCell的底部到頂部,為此,它可以正常工作:

-(void)tableView:(UITableView *)tableView willDisplayCell:(audioVcCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{


cell.alpha =0.0;

    UIView *cellContentView = [cell contentView];
    CGFloat rotationAngleDegrees = -30;
    CGFloat rotationAngleRadians = rotationAngleDegrees * (M_PI/180);
    CGPoint offsetPositioning = CGPointMake(0, cell.contentView.frame.size.height*4);
    CATransform3D transform = CATransform3DIdentity;
    transform = CATransform3DRotate(transform, rotationAngleRadians, -50.0, 0.0, 1.0);
    transform = CATransform3DTranslate(transform, offsetPositioning.x, offsetPositioning.y, -50.0);
    cellContentView.layer.transform = transform;
    cellContentView.layer.opacity = 0.8;

    [UIView animateWithDuration:3.0 delay:indexPath.row+3 usingSpringWithDamping:0.85 initialSpringVelocity:0.8 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        cellContentView.layer.transform = CATransform3DIdentity;
        cellContentView.layer.opacity = 1;
        cell.alpha=1.0;

    } completion:^(BOOL finished) {

    }];

}

在這里,我要顯示每個單元格,間隔為2或3秒。 目前,Cell將快速顯示。 提前致謝。

我通過@PhaniRaghu給出的想法解決了這個問題,我對他的回答做了一些更改,效果很好。

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, indexPath.row * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
    [UIView animateWithDuration:3.0 
            delay:indexPath.row 
            usingSpringWithDamping:0.85 
            initialSpringVelocity:0.8 
            options:UIViewAnimationOptionCurveEaseInOut 
            animations:^{
                cellContentView.layer.transform = CATransform3DIdentity;
                cellContentView.layer.opacity = 1;
                cell.alpha=1.0;
    } completion:^(BOOL finished) {
    }];
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM