超级视图旋转后获取子视图位置

发布于 2024-12-25 05:16:54 字数 310 浏览 2 评论 0原文

我有一个 UIView,它有几个响应触摸的子视图。如果我使用如下代码旋转超级视图的

[CATransaction begin];
[CATransaction setDisableActions:true];
view.layer.transform = CATransform3DRotate(view.layer.transform, angle, 0, 0, 1);
[CATransaction commit];

...那么在响应触摸事件时我似乎无法找到子视图的正确位置...有什么想法吗?

I have a UIView which has several subviews that respond to touch. If I rotate the layer of the superview with some code like this:

[CATransaction begin];
[CATransaction setDisableActions:true];
view.layer.transform = CATransform3DRotate(view.layer.transform, angle, 0, 0, 1);
[CATransaction commit];

... then I can't seem to find the right location of the subviews when responding to touch events... Any ideas?

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

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

发布评论

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

评论(1

王权女流氓 2025-01-01 05:16:54

我找到了它,我猜效果很好。我需要在 UIView 之间转换点以进行贝塞尔曲线命中测试:

-(BOOL)containsPoint:(CGPoint)point
{
    point = [self.superview.superview convertPoint:point toView:self];
    return [self.slicePath containsPoint:point];
}

I found it, worked out beautifully I guess. I needed to convert points between UIViews for doing bezier hit testing:

-(BOOL)containsPoint:(CGPoint)point
{
    point = [self.superview.superview convertPoint:point toView:self];
    return [self.slicePath containsPoint:point];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文