![](/img/trans.png)
[英]Scrolling to bottom of UITableView (UITableView is in a UITableViewCell)
[英]UITableViewCell animation breaks UITableView touch detection and scrolling
我试图在首次出现新UITableViewCells时显示类似于google +的动画。
这就是我在做什么:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if([[self serverFetchControllerForTableView:tableView] hasDataAtIndexPath:indexPath])
{
if (![[self shownIndexesForTableView:tableView] containsObject:indexPath]) {
[[self shownIndexesForTableView:tableView] addObject:indexPath];
UIView* view = [cell contentView];
view.layer.transform = self.initialTransformation;
view.layer.opacity = 0.0;
[UIView animateWithDuration:ANIMATION_CELL_APPEARANCE_TIME animations:^{
view.layer.transform = CATransform3DIdentity;
view.layer.opacity = 1;
}];
}
}
}
//initial transformation looks like that
CGFloat rotationAngleRadians = ANIMATION_CELL_APPEARANCE_ANGLE_DEG * (M_PI/180);
CATransform3D transform = CATransform3DIdentity;
transform = CATransform3DRotate(transform, rotationAngleRadians, 1.0, 0.0, 1.0);
transform = CATransform3DTranslate(transform, ANIMATION_CELL_APPEARANCE_X, ANIMATION_CELL_APPEARANCE_Y, 0.0);
self.initialTransformation = transform;
一切都在视觉上起作用,但是当这些单元格出现时,我将失去对UITableView滚动的完全控制-我无法触摸单元格,停止滚动或选择其中的任何一个,直到动画完成。
有没有人有任何建议可以解决这个问题呢?
可以在这里找到相同的问题: http : //www.raywenderlich.com/49311/advanced-table-view-animations-tutorial-drop-in-cards
尝试在TipInCellAnimator中将时间设置为3.0秒,因为3.0控件完全丢失。
这是使用animateWithDuration...
方法之一的动画的正常行为。 如果要在动画过程中进行用户交互,请尝试使用animateWithDuration:delay:options:animations:completion:
并传递UIViewAnimationOptionAllowUserInteraction
作为选项。 我不知道这会对动画产生什么影响,但是它应该允许用户交互。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.