本文介绍了SCNView 到 UIView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从 SCNView 转换为 UIView?我的 SCNView 上有一个覆盖层的登录按钮,但我希望登录按钮将用户带到 UIView 进行登录.
Is it possible to translate from a SCNView to a UIView? I have a login button from an overlay on my SCNView but I want the login button to take the user to a UIView to login.
推荐答案
可能不是最优雅的方法,但这样的方法可能对您有用.....
May not be the most elegant way to do it but something like this might work for you.....
- (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
// .........
}
}
这篇关于SCNView 到 UIView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!