UIView的convertRect:fromView:返回一个更大的rect?

时间:2014-04-08 05:50:48

标签: ios objective-c uiview uiviewcontroller

<UIViewControllerContextTransitioning>对象中,我正在尝试将矩形从一个坐标系转换为另一个坐标系。

当我调用convertRect:fromView:但是,我似乎回到了一个奇怪的值 - 原点看起来是正确的,但是我的rect的尺寸增加了一倍。

这是我的代码

    UIGraphicsBeginImageContextWithOptions(fromViewController.view.bounds.size, YES, 0);
    [fromViewController.view drawViewHierarchyInRect:fromViewController.view.bounds afterScreenUpdates:NO];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    image = [image applyLightEffect];
    UIGraphicsEndImageContext();

    UIView *container = [UIView new];
    container.frame = endFrame;
    container.clipsToBounds = YES;
    UIImageView *imgView = [UIImageView new];
    imgView.image = image;
    //fromViewController.view's frame is printing out as: frame = (0 0; 320 568);
    imgView.frame = [container convertRect:fromViewController.view.frame fromView:transitionContext.containerView];
    //imgView.frame is printing out as: frame = (-40 -60; 640 1136)
    [container addSubview:imgView];

我错过了什么吗?为什么直肠会长大?

0 个答案:

没有答案