Animate UITableViewCell with genie effect
I'm stuck. I have a TableView with messages. Upon selection these will be deleted and moved to trash. I get the genie effect real easy by using it in controller:didChangeContent [...] case NSFetchedResultsChangeDelete
but it animaties behind the other cells. But I want it on top of the other cells. What am I doing wrong?
Here is the animation Code:
[UIView beginAnimations:@"suck" context:NULL];
[UIView setAn开发者_开发知识库imationTransition:103 forView:myCell cache:YES];
[UIView setAnimationDuration:0.5];
[UIView setAnimationPosition:CGPointMake(50, 710)];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[UIView commitAnimations];
Got the Idea from here.
You could try bringing your cell to the front by doing this:
[myCell.superview bringSubviewToFront:myCell]
You can get source code from this link
In ViewController.m file do the following changes
- (void) genieToRect: (CGRect)rect edge: (BCRectEdge) edge
{
NSTimeInterval duration = self.durationSlider.value;
CGRect endRect = CGRectInset(rect, 5.0, 5.0);
[self.buttons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) {
button.enabled = NO;
}];
if (self.viewIsIn) {
[self.draggedView genieOutTransitionWithDuration:duration startRect:endRect startEdge:edge completion:^{
self.draggedView.userInteractionEnabled = YES;
[self.buttons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) {
button.enabled = YES;
}];
}];
} else {
self.draggedView.userInteractionEnabled = NO;
[self.draggedView genieInTransitionWithDuration:duration destinationRect:endRect destinationEdge:edge completion:
^{
[self.buttons enumerateObjectsUsingBlock:^(UIButton *button, NSUInteger idx, BOOL *stop) {
button.enabled = YES;
}];}];
}
self.viewIsIn = ! self.viewIsIn;
}
Hope it helps.. Happy Coding !!!
精彩评论