Hi i am trying to implement a transition from a UITableViewCell to a new controller, while transitioning i want to move the cell's label to the position of the new label in the new controller, and when dismissing the controller, the label should go back to original position in the cell. The effect is replicated in this link: http://framerjs.com/examples/preview/#detail-view-transition.framer
Can anybody point me in the right direction?
Instead of actually animating the UITableViewCell it might be sufficient to "fake" it. One way that would work is to pass the frame of the UITableViewCell in the controller's view to the next view controller. Then when the next view loads animate the corresponding views into position starting from that frame you just passed. Might look something like this.
@property (assign, nonatomic) CGRect cellFrameForNextView;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
self.cellFrameForNextView = cell.frame;
self.cellFrameForNextView.origin = [cell convertPoint:cell.frame.origin toView:self.view];
[self performSegueWithIdentifier:@"showNextView" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqualToString:@"showNextView"]) {
NextViewController *vc = (NextViewController*)[segue destinationViewController];
vc.frameToStartAnimation = self.cellFrameForNextView;
}
}
And then in your next view
@property (assign, nonatomic) CGRect frameToStartAnimation;
@property (strong, nonatomic) UIView *viewThatWillAnimate;
-(void)viewDidAppear:(animated)animated
{
[super viewDidAppear:animated]
CGRect frameToFinishAnimation = self.viewThatWillAnimate.frame;
self.viewThatWillAnimate.frame = self.frameToStartAnimation;
[UIView animationWithDuration:0.3 animations:^{
self.viewThatWillAnimate.frame = frameToFinishAnimation;
}];
}
This is not a perfect solution, but I hope it puts you in the right direction to a solution :)