SCNView到UIView?

问题描述:

是否有可能从SCNView翻译成UIView?我有一个来自我的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 
     // ......... 
    } 

}