0
我需要在滚动时创建如下图所示的表格视图动画,但是我对动画几乎没有任何想法。而且我还需要通过向内移动选择的单元格进行动画制作,并在上下单元格关闭时消失(例如在删除iPhone中的文本消息时完成的动画)。 UITableViewCell在滚动时弯曲动画
我需要在滚动时创建如下图所示的表格视图动画,但是我对动画几乎没有任何想法。而且我还需要通过向内移动选择的单元格进行动画制作,并在上下单元格关闭时消失(例如在删除iPhone中的文本消息时完成的动画)。 UITableViewCell在滚动时弯曲动画
您必须劫持scrollView(将自己添加为TableViewDelegate旁边的ScrollViewDelegate),并且表视图将自动沿着侧面桌面事件转发scrollview事件。
(self.tableView.delegate =自我)是真正谈话既
<UIScrollViewDelegate, UITableViewDelegate>
我已经在也计算到电池的顶部的距离的例子的辅助函数。
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
NSArray *rows = [self.tableView indexPathsForVisibleRows];
for (NSIndexPath *path in rows) {
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:path];
float percent = [self cellDistanceAsPercentageFromTableViewCenterAtRow:cell];
cell.layer.sublayerTransform = CATransform3DMakeScale(percent, percent, 1);
}
}
//Calculate distance of the cell as a percentage from the bottom of the actual visible contentView
-(float)cellDistanceAsPercentageFromTableViewCenterAtRow:(UITableViewCell *)cell {
float position = cell.frame.origin.y;
float offsetFromTop = self.tableView.contentOffset.y;
float percentFromBottom = (position-offsetFromTop+ROW_HEIGHT)/self.tableView.frame.size.height;
percentFromBottom = MIN(MAX(percentFromBottom, 0), 1);
return percentFromBottom;
}
不工作的兄弟 –
嘿!我想给你一些链接,值得一看:http://www.thinkandbuild.it/animating-uitableview-cells/,https://developer.apple.com/library/ios/documentation /uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html,http://stackoverflow.com/questions/12202221/uitableview-core-animation –
好东西!我从该网站重新创建了相同的示例,现在我将如何更改此数学旋转= CATransform3DMakeRotation((90.0 * M_PI)/ 180,0.0,0.7,0.4); rotation.m34 = 1.0/-600; cell.layer.transform = rotation; cell.layer.anchorPoint = CGPointMake(0,0.5)'带来我的动画 – KhanXc
嘿!你想研究的是名为Core Graphics affineTransformation。我建议看看这里:https://developer.apple.com/library/mac/documentation/graphicsimaging/conceptual/drawingwithquartz2d/dq_affine/dq_affine.html –