SpriteKit中的滚动视图 [英] Scroll View in SpriteKit

查看:109
本文介绍了SpriteKit中的滚动视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在SpriteKit游戏中为水平选择器制作一个垂直滚动视图,我不知道是否必须使用UIScrollView或使用SpriteKit框架来制作它.如果有人知道最好的方法,请告诉我.谢谢.

I want to make a vertical scrolling view for the level selector on my SpriteKit game, I don't know if I have to use UIScrollView or make it using the SpriteKit framework. Please if anyone knows the best way to do it and how let me know. Thanks.

推荐答案

您在这里有几个选择.

You have several options here.

可以将UI元素集成到SpriteKit中,但是可以将子视图添加到self.view,而不是将子视图添加到self(您的场景).当然,您现在将使用视图而不是场景,因此有一种定位元素的不同方法,您必须将它们定位出来.关于此操作的示例很多,

It is possible to integrate UI elements into SpriteKit, but instead of adding children to self (your scene), you would add subviews to self.view. You would of course, work with the view now instead of a scene so theres a different way of positioning elements which you would have to work out. Theres quite a few examples of how to do this, here's one that might help you.

一种替代方法是使用类似 Scroll Kit 的工具,它可以帮助您非常方便地将UIScrollView集成到SpriteKit中!

An alternative is using something like Scroll Kit, which helps you integrate a UIScrollView into SpriteKit very conveniently!

还要查看这个问题,可能正是您要查找的问题.希望这会有所帮助!

Also check out this question which might be exactly what you're looking for. Hope this helps!

这篇关于SpriteKit中的滚动视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆