知道为什么以下UIView动画只能在一个方向上工作吗?

时间:2011-08-04 00:12:04

标签: iphone ios uitableview animation uiview

我的cellForRowAtIndex委托方法结束时有以下动画,它只是根据我是否设置了伪编辑标志来左/右移动所有单元格:

[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)

问题是它只能在从右向左移动而从正常状态从左向右移动时在一个方向上工作。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

原来我的FetchedResultsController在动画开始后直接重新加载了表格,取消了它。