美文网首页学习中ing...
给UITableViewCell添加动画

给UITableViewCell添加动画

作者: 那片阳光已醉 | 来源:发表于2017-02-06 17:39 被阅读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]; } }

相关文章

网友评论

    本文标题:给UITableViewCell添加动画

    本文链接:https://www.haomeiwen.com/subject/assuittx.html