2017-02-03 7 views
0

SCNViewからUIViewへの変換は可能ですか?私はSCNViewのオーバーレイからログインボタンを持っていますが、ログインボタンを使用してUIViewにログインしてログインさせたいと思っています。SCNViewからUIView?

答えて

0

それを行うための最もエレガントな方法ではないかもしれないが、このような何かがあなたのために働くかもしれない.....

- (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 
     // ......... 
    } 

} 
関連する問題