开发者

Any idea why the following UIView animation only works in one direction?

开发者 https://www.devze.com 2023-03-25 07:43 出处:网络
I have the following animation at the end of my cellForRowAtIndex Delegate method which just shifts all the cells left/right depending on whether i have the pseudoEditing flag set or not:

I have the following animation at the end of my cellForRowAtIndex Delegate method which just shifts all the cells left/right depending on whether i have the pseudoEditing flag set or not:

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

Here is where the constants are declared:

#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         CGRectM开发者_如何学Pythonake(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)

The problem is that it only works in one direction when shifting back from right to left and not from the normal state from left to right.

Any ideas?


Turns out my FetchedResultsController was reloading the table directly after the animation began which cancelled it out.

0

精彩评论

暂无评论...
验证码 换一张
取 消