Question

So I'm creating an iPad app that displays images in a UITableView and when when a row/image is selected it pushes another view controller that plays a video in full screen. This is all working correctly but I want to animate the transition from the image's original size in the table to the fullscreen video. This video here displays what I want at about 1 second in http://www.apple.com/ipad/videos/#itunes. So how would I get the frame of the cell that is selected? And how would I transition the view from the cell frame to full screen?

Here is how I am doing the transition now:

- (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath 
{
    if (indexPath.row == 0) 
    {
        VideoViewController * video1 = [[VideoViewController alloc] init];
        UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:video1];
        navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        navController.modalPresentationStyle = UIModalPresentationFullScreen;
        navController.navigationBarHidden = YES;

        [self presentModalViewController:navController animated:YES];
    }
}
Was it helpful?

Solution

There is an open source project called UAModalPanel which does something very smiler to what you are trying to achieve. You would need to get your cell view by calling the UITableView method:

- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath

Then you need to convert the cell's center point to the superview coordinate plane by using:

 - (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view;

Then you can pass this center point to the panel to show from there.




full disclosure: I am the maintainer of the project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top