Flip animation in sub-UIView don´t found - objective-c

I want flip movement in my subview.
In next method change my subview but without flip animation....
int tag=g.view.tag;
UIViewController* vc2 = [controlersOfTableBoxes objectAtIndex:tag-1];
UIView* viewOfSelf = self.view;
UIViewController* v = [[UIViewController alloc] init];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:v.view cache:NO];
int maxGraphs = [[viewOfSelf subviews] count];
for (int i = 0; i < maxGraphs; i++ )
{
if([[[viewOfSelf subviews] objectAtIndex:i] isKindOfClass:[UIView class]])
{
UIView* v = [[viewOfSelf subviews] objectAtIndex:i];
if(v.tag==tag)
{
[[[viewOfSelf subviews] objectAtIndex:i] removeFromSuperview];
break;
}
}
}
[viewOfSelf addSubview:vc2.view];
v.view = viewOfSelf;
[UIView commitAnimations];
If i change this lines:
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:v.view cache:NO];
for
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:NO];
the movement is in all of screen but i want only in subview in subviewcontroller.
I try to this method:
[UIView animateWithDuration:0.5f delay:0.0f options:UIViewAnimationTransitionFlipFromRight animations:^(void)
{
int tag=g.view.tag;
UIViewController* vc2 = [controlersOfTableBoxes objectAtIndex:tag-1];
UIView* viewOfSelf = self.view;
UIViewController* v = [[UIViewController alloc] init];
int maxGraphs = [[viewOfSelf subviews] count];
for (int i = 0; i < maxGraphs; i++ )
{
if([[[viewOfSelf subviews] objectAtIndex:i] isKindOfClass:[UIView class]])
{
UIView* view = [[viewOfSelf subviews] objectAtIndex:i];
if(view.tag==tag)
{
v.view=view;
[[[viewOfSelf subviews] objectAtIndex:i] removeFromSuperview];
break;
}
}
}
[viewOfSelf addSubview:vc2.view];
v.view = viewOfSelf;
}
completion:^(BOOL finished)
{}];
but the result is the same...

you can use
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:5];
[UIView transitionFromView:view2 toView:view1 duration:3 options:UIViewAnimationOptionTransitionFlipFromBottom completion:NULL];
[UIView commitAnimations];
try
i
nt tag=g.view.tag;
UIViewController* v = [controlersOfBoxes objectAtIndex:tag-1];
UIViewController* vc2 = [controlersOfTableBoxes objectAtIndex:tag-1];
[UIView transitionWithView:vc2.view duration:0.5 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^ { [v.view removeFromSuperview]; [self.view addSubview:vc2.view]; } completion:nil];

Related

UIAlertView fades in from top right how to stop

I have added a scrollview as a subview and it drops down in to my view when a button is clicked but when I click the logout button the UIAlertView behaviour has changed since I added it in. When I click on logout the UIAlertView fades in from the top right. Don't see why the behaviour has changed or why it would do that any ideas?
#synthesize scrollView;
#synthesize showMenu;
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = #"Members Area";
showMenu = false;
[self.view addSubview:scrollView];
}
- (IBAction)LogOut:(id)sender{
UIAlertView *logoutMessage = [[UIAlertView alloc] initWithTitle:#"Logout"
message:#"Are you sure you want to logout?"
delegate:self
cancelButtonTitle:#"No"
otherButtonTitles:#"Yes", nil];
[logoutMessage show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:#"No"])
{
//NSLog(#"You clicked No");
}
else if([title isEqualToString:#"Yes"])
{
//NSLog(#"You clicked Yes");
[self performSegueWithIdentifier:#"LogoutView" sender:self];
}
}
- (IBAction)DropDownMenuMembers:(id)sender{
if (showMenu == false) {
showMenu = true;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:0.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIButton beginAnimations:nil context:nil];
[UIButton setAnimationDuration:0.5];
[UIButton setAnimationDelay:0.0];
[UIButton setAnimationCurve:UIViewAnimationCurveEaseInOut];
scrollView.frame = CGRectMake(0, 0, 320, 100);
// openMenu.frame = CGRectMake(267,101, 47, 30);
[self.view bringSubviewToFront:scrollView];
[UIView commitAnimations];
}
else{
showMenu = false;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:0.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIButton beginAnimations:nil context:nil];
[UIButton setAnimationDuration:0.5];
[UIButton setAnimationDelay:0.0];
[UIButton setAnimationCurve:UIViewAnimationCurveEaseInOut];
scrollView.frame = CGRectMake(0, -100, 320, 100);
//openMenu.frame = CGRectMake(262, 20, 47, 30);
[UIView commitAnimations];
}
}
there was a problem with the animation, this resolved the issue:
How to slide UIView from side on top of current view (iPhone)

uiview animatewithduration completion continues after view is dismissed

I have a modelViewController that contains a UIView animation. When the animation block finishes it calls itself, thus looping.
When I dismiss the modelViewController (dismissInfo) which calls [_starView removeFromSuperview], the function gets called over and over very rapidly with the NSLog line being printed multiple times a second.
#implementation InfoVC
{
NSArray *imgs;
NSString *currentImg;
}
- (void)viewDidLoad
{
[super viewDidLoad];
_imageview.contentMode = UIViewContentModeLeft;
_imageviewUnder.contentMode = UIViewContentModeLeft;
imgs = [NSArray arrayWithObjects:
#"01.jpg",
#"02.jpg",
#"03.jpg",
#"04.jpg",
#"05.jpg",
#"06.jpg",
nil];
_imgInt = (arc4random()%6);
[self initialImage];
}
- (void)viewWillAppear:(BOOL)animated{
}
- (void)viewDidAppear:(BOOL)animated{
NSLog(#"viewDidAppear");
}
- (void)initialImage
{
_starView.contentMode = UIViewContentModeLeft;
_imageviewUnder.contentMode = UIViewContentModeLeft;
currentImg = [imgs objectAtIndex:_imgInt];
UIImage *image = [UIImage imageNamed:currentImg];
_starView = [[UIImageView alloc] initWithImage:image];
// Size the image view to the image (it's bigger)
_starView.bounds = CGRectMake(0.0, 44.0, 416.0, 416.0);
NSLog(#"tarView.center %#", NSStringFromCGPoint(_starView.center) );
_starView.alpha=1;
int nextImgInt = _imgInt + 1 ;
if (nextImgInt>5)
{
nextImgInt=0;
}
NSString *nextImg = [imgs objectAtIndex:nextImgInt];
UIImage *nextImage = [UIImage imageNamed:nextImg];
[_imageviewUnder setImage:nextImage];
[self.view sendSubviewToBack:_imageviewUnder];
_imgInt++;
if (_imgInt>5) {
_imgInt=0;
}
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView animateWithDuration:7.6f
delay:0.1f
options:UIViewAnimationCurveLinear
animations:^{
[_starView setCenter:CGPointMake(112, 208)];
[_starView setAlpha:0.0f];
}
completion:^(BOOL finished){
[_starView removeFromSuperview];
[self initialImage];
}];
[self.view insertSubview:_starView atIndex:1];
}
- (void)visitTwitter
{
NSURL *URL = [NSURL URLWithString:#"http://twitter.com/"];
SVWebViewController *webViewController = [[SVWebViewController alloc] initWithURL:URL];
[self.navigationController pushViewController:webViewController animated:YES];
}
- (IBAction)dismissInfo:(id)sender
{
[self cleanup];
[self dismissModalViewControllerAnimated:YES];
}
- (void)cleanup
{
[_starView.layer removeAllAnimations];
[self.view.layer removeAllAnimations];
[_starView removeFromSuperview];
}
- (void)viewDidUnload
{
[self cleanup];
[super viewDidUnload];
}
#end
Make yourself an animating flag, set true in viewDidLoad, and false in cleanup. Then check it in your initialImage method:
if ( ! animating )
return;
This is the second time I've come across this. One possible cause is the method being initialised in viewDidLoad but the subview and image not being ready in time (it seems the first pass of the animation loop doesn't work adding a ghost to the machine).
I moved the call to ViewDidAppear, making sure to display an initialisation image to stop the white flash. At last an infinite animation in a modal window
- (void)viewDidLoad
{
[super viewDidLoad];
_imageview.contentMode = UIViewContentModeLeft;
_imageviewUnder.contentMode = UIViewContentModeLeft;
imgs = [NSArray arrayWithObjects:
#"01.jpg",
#"02.jpg",
#"03.jpg",
#"04.jpg",
#"05.jpg",
#"06.jpg",
nil];
_imgInt = (arc4random()%6);
currentImg = [imgs objectAtIndex:_imgInt];
UIImage *image = [UIImage imageNamed:currentImg];
[_imageviewUnder setImage:image];
}
- (void)viewDidAppear:(BOOL)animated{
[self initialImage];
}
- (void)initialImage
{
currentImg = [imgs objectAtIndex:_imgInt];
UIImage *image = [UIImage imageNamed:currentImg];
_starView = [[UIImageView alloc] initWithImage:image];
// Size the image view to the image (it's bigger)
_starView.bounds = CGRectMake(0.0, 44.0, 416.0, 416.0);
NSLog(#"initialImage");
_starView.alpha=1;
[self.view insertSubview:_starView atIndex:1];
int nextImgInt = _imgInt + 1 ;
if (nextImgInt>5)
{
nextImgInt=0;
}
NSString *nextImg = [imgs objectAtIndex:nextImgInt];
UIImage *nextImage = [UIImage imageNamed:nextImg];
[_imageviewUnder setImage:nextImage];
[self.view sendSubviewToBack:_imageviewUnder];
_imgInt++;
if (_imgInt>5) {
_imgInt=0;
}
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:7.6];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
//[UIView setAnimationDidStopSelector:#selector(initialImage) ];
[_starView setCenter:CGPointMake(112, 208)];
[_starView setAlpha:0.0f];
[UIView commitAnimations];
[self performSelector:#selector(initialImage) withObject:nil afterDelay:7.6];
}
- (IBAction)dismissInfo:(id)sender
{
[self cleanup];
[self dismissModalViewControllerAnimated:YES];
}
- (void)cleanup
{
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[_starView.layer removeAllAnimations];
[self.view.layer removeAllAnimations];
[_starView removeFromSuperview];
}
If you just want to create a looping animation, the best thing to do is use the option: 'UIViewAnimationOptionRepeat'. For example:
[UIView animateWithDuration:2.0
delay:0.0f
options:UIViewAnimationOptionRepeat
animations:^{
[myUIViewThing setCenter:CGPointMake(myUIViewThing.center.x - 100, myUIViewThing.center.y)];
}
completion:nil];

Animate UIButton becoming hidden and unhidden

So, I have a UIButton that, when a UITextField is in editing mode, becomes hidden and unhidden. The problem is, it changes perfectly fine (from hidden to unhidden), but doesn't animate. I've tried setAlpha: instead, but that only works when it is setting its alpha from 0 to 100, not 100 to 0. Here is my code so far:
-(BOOL) textFieldShouldBeginEditing:(UITextField *)textField
{
negButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
negButton.frame = CGRectMake(textField.frame.origin.x, textField.frame.origin.y, 37, textField.frame.size.height);
[negButton setHidden:YES];
return YES;
}
-(void) textFieldDidBeginEditing:(UITextField *)textField
{
if ([textField isEditing])
{
[UIView animateWithDuration:0.3 animations:^
{
CGRect frame = textField.frame;
frame.size.width -= 40;
frame.origin.x += 40;
[negButton setHidden:NO];
[textField setFrame:frame];
[self.view addSubview:negButton];
}];
}
}
-(void) textFieldDidEndEditing:(UITextField *)textField
{
[UIView animateWithDuration:0.3 animations:^
{
CGRect frame = textField.frame;
frame.size.width += 40;
frame.origin.x -= 40;
[negButton setHidden:YES];
[negButton removeFromSuperview];
[textField setFrame:frame];
}
];
}
EDIT: I resolved the issue. I just didn't have to call the removeFromSuperview function, and I had to switch from hidden to alpha. (See #David's answer below)
You have a problem with your animations. Change it to the following:
-(BOOL) textFieldShouldBeginEditing:(UITextField *)textField
{
negButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
negButton.frame = CGRectMake(textField.frame.origin.x, textField.frame.origin.y, 37, textField.frame.size.height);
[negButton setAlpha:0];
[self.view addSubView:negButton];
return YES;
}
-(void) textFieldDidBeginEditing:(UITextField *)textField
{
if ([textField isEditing])
{
CGRect frame = textField.frame;
frame.size.width -= 40;
frame.origin.x += 40;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
[negButton setAlpha:1];
[textField setFrame:frame];
[UIView commitAnimations];
}
}
-(void) textFieldDidEndEditing:(UITextField *)textField
{
CGRect frame = textField.frame;
frame.size.width += 40;
frame.origin.x -= 40;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
[negButton setAlpha:0];
[textField setFrame:frame];
[UIView commitAnimations];
[self performSelector:#selector(removeBtn) withObject:negButton afterDelay:0.3];
}
- (void)removeBtn:(UIButton*)button
{
[button removeFromSuperView];
}
You were removing the button from the view immediately instead of removing it after it had faded out.
Cheers!

Auto scroll functionality in iPhone SDK

I had added auto scroll functionality to my application by going through sample code.
In this code I'm getting scroll from top to bottom and bottom to top. But I don't want to scroll from top to bottom . I always wants to scroll from bottom to top only. If I'm removing the topToBottom code and making changes to the remaining code according to that it is not working. Can any one help me.
-(void)viewdidLoad
{
infoScrollView = [[UIScrollView alloc]init];
infoScrollView.frame = CGRectMake(0,0,330,270);
infoScrollView.contentSize = CGSizeMake(100,1000);
[myInfoView addSubview:infoScrollView];
scrollingToTop=NO;
UIImageView *infoImgView = [[UIImageView alloc]initWithFrame:CGRectMake(70,0,200,1000)];
infoImgView.image = [UIImage imageNamed:#"lepke-tar2.png"];
[infoScrollView addSubview:infoImgView];
infoScrollView.delegate = self;
if (infoScrollView.contentSize.height>infoScrollView.frame.size.height)
{
[infoScrollView scrollRectToVisible:CGRectMake(0, infoScrollView.contentSize.height-infoScrollView.frame.size.height, infoScrollView.frame.size.width, infoScrollView.frame.size.height) animated:NO];
}
[self performSelector:#selector(scrollToTop) withObject:nil afterDelay:0.5];
[myInfoView addSubview:infoScrollView];
UIButton* infocancelBttn = [[UIButton alloc ]initWithFrame:CGRectMake(295,-8,45,45)];
[infocancelBttn setImage:[UIImage imageNamed:#"cancel_icon.png"] forState:UIControlStateNormal];
[infocancelBttn addTarget:self action:#selector(infoViewCloseAction) forControlEvents:UIControlEventTouchUpInside];
[myInfoView addSubview:infocancelBttn];
[infocancelBttn release];
}
-(void)viewDidAppear:(BOOL)animated
{
[infoScrollView scrollRectToVisible:CGRectMake(0, 0, infoScrollView.frame.size.width, infoScrollView.frame.size.height+200) animated:YES];
}
- (void) scrollToTop
{
scrollingToTop=YES;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:10.0];
//[self.scrollView scrollRectToVisible:CGRectMake(0, 0, self.scrollView.frame.size.width, self.scrollView.frame.size.height) animated:YES];
[infoScrollView setContentOffset:CGPointMake(0,-300)];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:#selector(scroll)];
[UIView commitAnimations];
}
-(void) scroll
{
if (scrollingToTop==YES)
{
[self performSelector:#selector(scrollToBottom) withObject:nil afterDelay:1.0];
}
else
{
[self performSelector:#selector(scrollToTop) withObject:nil afterDelay:1.0];
}
}
- (void)scrollToBottom
{
scrollingToTop=NO;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:10.0];
[infoScrollView setContentOffset:CGPointMake(0,infoScrollView.contentSize.height-infoScrollView.frame.size.height)animated:NO];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:#selector(scroll)];
[UIView commitAnimations];
}
I think your if-statement is wrong:
-(void) scroll
{
if (scrollingToTop==YES)
{
[self performSelector:#selector(scrollToBottom) withObject:nil afterDelay:1.0];
}
else...
if you delete your scrollToBottom-method your code fails.
you should change this to
[self performSelector:#selector(scrollToTop) withObject:nil afterDelay:1.0];
because you are asking if scrollingToTop is true

How to copy cells between tables as the pulse app

I need to copy cells between 2 table views.
I have a more-or-less working solution. However, it is not smooth, and I would love to do something similar to the pulse app reorder feeds option...
Something special in the way that pulse works, is that the reorder animation is the same as in a normal reorder of cells, but still the cell can move between tables.
This is what I have now:
- (BoardColumnView *) addColumn:(NSString *)title type:(ColumnType)type{
BoardColumnView *col = [BoardColumnView createColumn:title];
[self.columns addObject:col];
// Add a pinch gesture recognizer to the table view.
UILongPressGestureRecognizer* draggingRecognizer = [[UILongPressGestureRecognizer alloc]
initWithTarget:self
action:#selector(moveActionGestureRecognizerStateChanged:)
];
draggingRecognizer.minimumPressDuration = 0.5;
draggingRecognizer.delegate = self;
[col.tableView addGestureRecognizer:draggingRecognizer];
[draggingRecognizer release];
return col;
}
#pragma mark -
#pragma mark UIGestureRecognizer Delegate/Actions
- (BOOL) gestureRecognizerShouldBegin: (UIGestureRecognizer *) gestureRecognizer
{
ALog(#"Drag detected");
return YES;
}
- (void) moveActionGestureRecognizerStateChanged: (UIGestureRecognizer *) recognizer
{
switch ( recognizer.state )
{
default:
case UIGestureRecognizerStateFailed:
// do nothing
break;
case UIGestureRecognizerStatePossible:
case UIGestureRecognizerStateCancelled:
{
ALog(#"Canceled");
[UIView beginAnimations: #"SnapBack" context: NULL];
[UIView setAnimationCurve: UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration: 0.5];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: #selector(finishedSnap:finished:context:)];
CGRect f = self.dragView.frame;
f.origin = _dragOriginCellOrigin;
self.dragView.frame = f;
[UIView commitAnimations];
break;
}
case UIGestureRecognizerStateEnded:
{
// move the real cell into place
[UIView beginAnimations: #"SnapToPlace" context: NULL];
[UIView setAnimationCurve: UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration: 0.5];
[UIView setAnimationDelegate: self];
[UIView setAnimationDidStopSelector: #selector(finishedSnap:finished:context:)];
CGRect r = self.dragView.frame;//[self.content rectForItemAtIndex: _emptyCellIndex];
CGRect f = self.dragView.frame;
f.origin.x = r.origin.x + floorf((r.size.width - f.size.width) * 0.5);
f.origin.y = r.origin.y + floorf((r.size.height - f.size.height) * 0.5);
NSLog( #"Gesture ended-- moving to %#", NSStringFromCGRect(f) );
self.dragView.frame = f;
self.dragView.transform = CGAffineTransformIdentity;
self.dragView.alpha = 1.0;
[UIView commitAnimations];
break;
}
case UIGestureRecognizerStateBegan:
{
ALog(#"Start move..");
// find the cell at the current point and copy it into our main view, applying some transforms
_lastColumn = (BoardColumnView *)[(UITableView *)recognizer.view superview];
_targetColumn = _lastColumn;
if (_lastIndexPath) {
[_lastIndexPath release];
_lastIndexPath = nil;
}
_lastIndexPath = [_lastColumn.tableView indexPathForRowAtPoint:[recognizer locationInView: _lastColumn]];
UITableViewCell *sourceCell = [_lastColumn.tableView cellForRowAtIndexPath:_lastIndexPath];
CGRect frame = [_lastColumn convertRect: sourceCell.frame fromView: self.content];
self.dragView = [[[UIImageView alloc] initWithImage:[sourceCell screenshot]] autorelease];
self.dragView.opaque = YES;
self.dragView.backgroundColor = _lastColumn.backgroundColor;
self.dragView.center = [recognizer locationInView: self.view];
//self.dragView.cornerRadius = 8; // if you like rounded corners
self.dragView.layer.shadowOffset = CGSizeMake(-5, 2);
self.dragView.layer.shadowRadius = 5;
self.dragView.layer.shadowOpacity = 0.5;
[content addSubview: self.dragView];
[content bringSubviewToFront:self.dragView];
// grab some info about the origin of this cell
_dragOriginCellOrigin = frame.origin;
[UIView beginAnimations: #"" context: NULL];
[UIView setAnimationDuration: 0.2];
[UIView setAnimationCurve: UIViewAnimationCurveEaseOut];
// transformation-- larger, slightly transparent
self.dragView.transform = CGAffineTransformMakeScale( 1.2, 1.2 );
self.dragView.alpha = 0.7;
[UIView commitAnimations];
/* // reload the grid underneath to get the empty cell in place
[self.content reloadItemsAtIndices: [NSIndexSet indexSetWithIndex: index]
withAnimation: AQGridViewItemAnimationNone];
*/
break;
}
case UIGestureRecognizerStateChanged:
{
// update draging cell location
self.dragView.center = [recognizer locationInView: self.view];
//Determinar sobre que columna esta flotando..
CGRect global;
if (_targetColumn) {
_targetColumn = nil;
}
for (BoardColumnView *col in self.columns) {
UITableView *table = col.tableView;
global = [table convertRect:self.dragView.frame fromView:content];
if ([table pointInside:global.origin withEvent:nil]) {
ALog([NSString stringWithFormat: #"Esta sobre la tabla %#", col.column.name]);
_targetColumn = col;
break;
}
}
if ( !_targetColumn )
{
ALog(#"Esta en zona muerta");
}
break;
}
}
}
- (void) finishedSnap: (NSString *) animationID finished: (NSNumber *) finished context: (void *) context
{
if (_targetColumn && _lastIndexPath) {
ALog(#"Moviendo a nuevo destino");
CGRect frame = [_targetColumn convertRect: self.dragView.frame fromView: self.content];
NSIndexPath *destPath = [_targetColumn.tableView indexPathForRowAtPoint: frame.origin];
[UIView beginAnimations: #"" context: NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:#selector(animationDidStop:finished:context:)];
self.dragView.backgroundColor = _targetColumn.backgroundColor;
//Si inserta entre tareas en destino...
_lastColumn.totalRows -= 1;
_targetColumn.totalRows += 1;
[_lastColumn.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:_lastIndexPath] withRowAnimation:UITableViewRowAnimationTop];
if (destPath) {
[_targetColumn.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:destPath] withRowAnimation:UITableViewRowAnimationBottom];
} else {
[_targetColumn.tableView reloadData];
}
[UIView commitAnimations];
} else {
ALog(#"Cancelado el moviento, regresar a home");
UITableViewCell * sourceCell = [_lastColumn.tableView cellForRowAtIndexPath:_lastIndexPath];
if (sourceCell) {
[UIView beginAnimations: #"Back" context: NULL];
[UIView setAnimationCurve: UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration: 0.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:#selector(animationDidStop:finished:context:)];
//self.dragView.transform = CGAffineTransformIdentity;
self.dragView.frame = [self.content convertRect: sourceCell.frame fromView: _lastColumn];
//self.dragView.alpha = 0.0;
[UIView commitAnimations];
}
}
}
- (void)animationDidStop:(id)animationID finished:(BOOL)flag context:(id)context {
// dismiss our copy of the cell
ALog(#"Eliminando drag view");
[self.dragView removeFromSuperview];
self.dragView = nil;
_lastColumn = nil;
_targetColumn = nil;
if (_lastIndexPath) {
_lastIndexPath = nil;
}
}
UPDATE: I've created an open source project to show my progress so far:
https://bitbucket.org/elmalabarista/dragdroptableviews