Scenekit - 我如何拖放

时间:2015-08-13 06:04:09

标签: ios objective-c iphone scenekit

使用下面显示的代码我可以在我的场景中有一个球体。带有蓝色背景......我是iOS中的sceneKit的新手。我想知道我们如何移动那个物体(将球体拖动到另一个位置) (掉落)。

.scrollTop(value)

1 个答案:

答案 0 :(得分:1)

是的,几个月前我用objective-c尝试过sceneKit可能会帮助你推广解决方案。对于节点的拖放,我使用了UIPanGestureRecognizer。

//用于平移(移动)的手势识别器

<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand " href="#" style="display:none;">
                <img src="http://placehold.it/150x50&amp;text=Logo" alt="">
            </a>
        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse navbar-center" id="bs-example-navbar-collapse-1">
            <div class="menu text-center">
                <ul class="nav navbar-nav">
                    <li>
                        <a href="#">About</a>
                    </li>
                    <li>
                        <a href="#">Services</a>
                    </li>
                    <li>
                        <a href="#">Contact</a>
                    </li>
                </ul>
                <ul class="nav navbar-nav">
                    <a class="navbar-brand " href="#">
                        <img src="http://placehold.it/150x50&amp;text=Logo" alt="">
                    </a>
                </ul>
                <ul class="nav navbar-nav">
                    <li>
                        <a href="#">About</a>
                    </li>
                    <li>
                        <a href="#">Services</a>
                    </li>
                    <li>
                        <a href="#">Contact</a>
                    </li>
                </ul>
            </div>
        </div>

        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>

<!-- Page Content -->
<div class="container">
    <div class="row">
        <div class="col-lg-12">
            <h1>Logo Nav by Start Bootstrap</h1>
            <p>Note: You may need to adjust some CSS based on the size of your logo. The default logo size is 150x50 pixels.</p>
        </div>
    </div>
</div>

//然后在“handlePanFrom”

UIGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanFrom:)];
[[self view] addGestureRecognizer:panGestureRecognizer];

如需更多帮助,您可以查看这个精彩的教程http://www.raywenderlich.com/44270/sprite-kit-tutorial-how-to-drag-and-drop-sprites