gpt4 book ai didi

swift - SCNView 到 UIView?

转载 作者:行者123 更新时间:2023-11-30 12:42:55 26 4
gpt4 key购买 nike

是否可以从 SCNView 转换为 UIView?我的 SCNView 上有一个覆盖层的登录按钮,但我希​​望登录按钮将用户带到 UIView 进行登录。

最佳答案

可能不是最优雅的方式,但这样的方法可能适合你......

- (void) handleTap:(UITapGestureRecognizer*)gestureRecognizer {

// get tap location
CGPoint p = [gestureRecognizer locationInView:scnView];

// convert to sk scene coordinates
CGPoint p2D = [scnView.overlaySKScene convertPointFromView:p];
//test if we hit the login button
SKNode *loginButton = [scnView.overlaySKScene nodeAtPoint:p2D];

// assuming your loginButton is of type SKLabelNode
if (loginButton != nil && ( [loginButton isMemberOfClass:[SKLabelNode class]] )) // add other tests here
{
// Here you can add code to transition to another
// view controller to handle logins


} else {
// do hit test on scnView here for the 3D scene
// .........
}

}

关于swift - SCNView 到 UIView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42032985/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com