在多次 CATransforms 之后找到屏幕上的子图层位置?

发布于 2024-08-18 04:14:43 字数 379 浏览 1 评论 0原文

我的 iPhone 应用程序有一个 mainView。 CircleView 作为子层添加到此 MainView。 CircleView 使用 3 个串联的 CATransform3D 变换,随着手机转动而旋转,并随着手机倾斜而倾斜。 DotView 作为子图层添加到 CircleView。在完成所有这些变换之后,我没有简单(或明显)的方法来了解 mainView 坐标系中 dotView 的坐标。

我还有另一个视图,squareView,也添加到主视图中。我确实知道 squareView 在 mainView 坐标系中的坐标。

我想使用 Quartz 2D 在 dotView 和 squareView 之间画一条线。如何找出 squareView 的坐标以便在两者之间画一条线?

谢谢。

My iPhone app has a mainView. added as a sublayer to this MainView is CircleView. CircleView rotates as the phone turns and tilts as the phone tilts, using 3 concatenated CATransform3D transforms. DotView is added as a sublayer to CircleView. After all these transoforms, I have no easy (or apparent) way of knowing the coordinates of dotView in the mainView coordinate system.

I also have another view, squareView, added to mainview as well. I do know the coordinates of squareView in mainView's coordinate system.

I want to use Quartz 2D to draw a line between a dotView and a squareView. How do I find out out the coordinates of squareView in order to draw a line between the two?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请帮我爱他 2024-08-25 04:14:43

您可能想查看相关图层的presentationLayer 属性。

You probably want to look at the presentationLayer property of the layer in question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文