学习中ing...

给UITableViewCell添加动画

2017-02-06  本文已影响13人  那片阳光已醉

取出可见的cell数组
[self.tableView visibleCells]

- (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat viewHeight = scrollView.height + scrollView.contentInset.top; // visibleCells 取出可见的cell数组 for (YYWebImageExampleCell *cell in [self.tableView visibleCells]) { CGFloat y = cell.centerY - scrollView.contentOffset.y; CGFloat p = y - viewHeight / 2; CGFloat scale = cos(p / viewHeight * 0.8) * 0.95; [UIView animateWithDuration:0.15 delay:0 options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState animations:^{ cell.webImageView.transform = CGAffineTransformMakeScale(scale, scale); } completion:NULL]; } }

上一篇 下一篇

猜你喜欢

热点阅读