Как анимировать UITableViewCell - PullRequest
0 голосов
/ 11 мая 2018

У меня есть UITableViewCell.Я пытаюсь анимировать индикатор выполнения, когда на экране появляется ячейка.Я пробовал следующее, но ничего не происходит.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellId = @"TableViewCellResult";

    TableViewCellResults *cell = [tableView dequeueReusableCellWithIdentifier:cellId];

    if (cell == nil) {
        cell = [[TableViewCellResults alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId];
    }

    // Add progress bar here

    // THIS DOES NOTHING
    [UIView animateWithDuration:10.f animations:^{
        progressBar.value = 55.f;
    }];

Как мне оживить UIProgressBar?UIProgressBar не принимает 'animateWithDuration'.

У меня есть рабочий пример анимации UIProgressBar в UIView (не ячейке), который использует тот же синтаксис.

1 Ответ

0 голосов
/ 06 июня 2018

Попробуйте выполнить анимацию, используя UIView.commmitAnimations () Например:

 UIView.beginAnimations(“rotation”, context: nil)

    UIView.setAnimationDuration(0.8)

    cell.layer.transform = CATransform3DIdentity

    cell.alpha = 1

    cell.layer.shadowOffset = CGSize(width: CGFloat(0), height: CGFloat(0))

    UIView.commitAnimations()

, также попробуйте выполнить операцию внутри willDisplayCell: Метод.

См. Это http://www.thinkandbuild.it/animating-uitableview-cells/ решение для анимации внутри ячейки табличного представления

...