Iphone 知道为什么下面的UIView动画只在一个方向上工作吗?
我的CellForRowatinex委托方法末尾有以下动画,根据是否设置了伪编辑标志将所有单元格向左/向右移动:Iphone 知道为什么下面的UIView动画只在一个方向上工作吗?,iphone,ios,uitableview,animation,uiview,Iphone,Ios,Uitableview,Animation,Uiview,我的CellForRowatinex委托方法末尾有以下动画,根据是否设置了伪编辑标志将所有单元格向左/向右移动: [UIView beginAnimations:@"cell shift" context:nil]; [UIView setAnimationDuration:kEventActionViewAnimationDuration]; cell.eventName.frame = (self.pseudoEditing) ? kPseudoEditingFirstIndentedRe
[UIView beginAnimations:@"cell shift" context:nil];
[UIView setAnimationDuration:kEventActionViewAnimationDuration];
cell.eventName.frame = (self.pseudoEditing) ? kPseudoEditingFirstIndentedRect : kFirstLabelRect;
cell.eventLocationName.frame = (self.pseudoEditing) ? kPseudoEditingSecondIndentedRect : kSecondaryLabelRect;
cell.eventStartDate.frame = (self.pseudoEditing) ? kPseudoEditingThirdIndentedRect : kThirdLabelRect;
cell.eventStartEndTime.frame = (self.pseudoEditing) ? kPseudoEditingFourthIndentedRect : kFourthLabelRect;
cell.imageView.frame = (self.pseudoEditing) ? kImageViewIndentedRect : kImageViewRect;
cell.rsvpImageView.hidden = !self.pseudoEditing;
[UIView commitAnimations];
return cell;
以下是声明常量的位置:
#define kImageViewRect CGRectMake(10, 9.0, 60.0, 60.0)
#define kFirstLabelRect CGRectMake(80, 10.0, 220.0, 20.0)
#define kSecondaryLabelRect CGRectMake(80, 30.0, 220.0, 20.0)
#define kThirdLabelRect CGRectMake(80, 50.0, 220.0, 20.0)
#define kFourthLabelRect CGRectMake(180.0, 50.0, 110.0, 20.0)
#define kPseudoEditingFirstIndentedRect CGRectMake(115.0, 10.0, 195.0, 20.0)
#define kPseudoEditingSecondIndentedRect CGRectMake(115.0, 30.0, 195.0, 20.0)
#define kPseudoEditingThirdIndentedRect CGRectMake(115.0, 50.0, 195.0, 20.0)
#define kPseudoEditingFourthIndentedRect CGRectMake(200.0, 50.0, 110.0, 20.0)
问题是,当从右向左切换时,它只在一个方向上工作,而不是从左向右切换到正常状态
有什么想法吗?我的FetchedResultsController在动画开始后直接重新加载表格,从而取消了它。你能展示一下设置动画的代码吗?你可能应该试试块动画,因为它们更简单,而且是苹果认可的方式。@MSgambel:Apple“认可”这两种方法都有。也许你的意思是使用块是首选的方法?@titaniumdecoy:是的,这就是我的意思。在iOS 4.0之后,苹果更喜欢使用块来制作动画。@XenElement,不确定你的意思,但这就是我正在使用的所有动画代码。回复:其他,需要向后兼容。