convertRect:toView:函数在iOS 9和iOS 10中有不同的结果

时间:2016-10-12 18:53:44

标签: ios objective-c iphone

我有 sourceFrame destinationFrame ,它由以下代码计算:

CGRect sourceFrame = [sourceView convertRect:sourceView.bounds toView:self.animationContainerView];
CGRect destinationFrame = [destinationView convertRect:destinationView.bounds toView:self.animationContainerView];

在iOS 9中,结果是

sourceFrame = (origin = (x = 0, y = 386), size = (width = 375, height = 45))
destinationFrame = (origin = (x = 48, y = 28), size = (width = 319, height = 32))

在iOS 10中,结果是

sourceFrame = (origin = (x = 0, y = 386), size = (width = 375, height = 45))
destinationFrame = (origin = (x = -139.5, y = -281), size = (width = 319, height = 32))

destinationFrame的起源在iOS 9和iOS 10中完全不同。

我不知道为什么?我想可能是在iOS 10中,Apple更改了convertRect:toView的实现,它会产生不同的结果。

任何人都知道为什么?

0 个答案:

没有答案