【问题标题】:iPad Animation of modal view controller from table cell表格单元格的模态视图控制器的 iPad 动画
【发布时间】:2012-07-05 17:13:16
【问题描述】:

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.这一切正常,但我想动画从表格中图像的原始大小到全屏视频的过渡。此处的此视频在 http://www.apple.com/ipad/videos/#itunes 中大约 1 秒显示我想要的内容。那么我将如何获得所选单元格的框架?以及如何将视图从单元格框架转换为全屏?

这是我现在的过渡方式:

- (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];
    }
}

【问题讨论】:

    标签: ios uitableview modalviewcontroller uimodaltransitionstyle


    【解决方案1】:

    有一个名为UAModalPanel 的开源项目,它对您想要实现的目标做了一些非常有趣的事情。您需要通过调用 UITableView 方法来获取单元格视图:

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

    然后你需要将cell的中心点转换为superview坐标平面:

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

    然后你可以把这个中心点传给面板,从那里显示出来。




    完全披露:我是项目的维护者。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-08
      • 2018-02-26
      • 1970-01-01
      相关资源
      最近更新 更多