在 cocos2d 中访问照片库

发布于 2024-09-26 07:07:12 字数 94 浏览 1 评论 0原文

我正在使用 cocos2d 创建游戏。 现在我想要的是将照片库中的图像插入到我的应用程序中。你能告诉我们如何通过cocos2d访问照片库吗?

提前致谢...

I am creating a game using cocos2d.
Now what I want is I need to insert the image from Photo Library to my application. Can you please tell how can we access Photo Library through cocos2d?

Thanks in ADVANCE...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

阳光下慵懒的猫 2024-10-03 07:07:12

您应该能够以正常方式访问用户照片库。至于实际使用所选照片,则是另一个问题。 <代码>;-)

You should be able to access the users Photo Library in the normal fashion. As far as actually using the selected photo, is a different question. ;-)

栀梦 2024-10-03 07:07:12

不确定这是否是您的意思,但是...

要在应用程序中使用图像,请将图像文件放在 xcode 的资源文件夹中。然后,您可以通过名称引用它,以将其用于您的精灵或任何其他将使用文件的东西。这也适用于您的应用程序将使用的其他类型的文件(例如数据文件、plist 等)。

如果您将一个图标文件放在 xcode 的资源文件夹中并将其命名为 icon.png,那么该图标将出现供用户选择在 iphone/ipod/ipad 上运行您的应用程序。

如果您将另一个文件放入资源文件夹中并将其命名为default.png,那么它将显示为加载应用程序时出现的启动屏幕,情况也是如此。

注意:如果您正在使用模板,它可能已经包含具有这些名称的固定文件。只需从 xcode 中的资源文件夹中删除它们并添加新的即可。要将文件添加到项目中,请将它们拖到 xcode 中的资源文件夹中,然后选中以下复选框:“将项目复制到目标组的文件夹中(如果需要)”,并确保在“添加目标”部分中仅选中该复选框选中您的应用程序名称,并选择单选按钮“为任何添加的文件夹递归创建组”。这会将文件复制到您的项目目录中,并且它们还将出现在 xcode 的资源文件夹中。然后你可以在 xcode 中点击它们来查看它们是否正确。

Not sure if this is what you mean but...

To use an image in your application you put the image file in your resources folder in xcode. Then you can reference it by name to use it for your sprites or anything else that will use a file. This goes for other types of files that your application will use too (like data files, plists, etc).

If you put an icon file in your resources folder in xcode and name it icon.png then that will be the icon that will appear for the user to select to run your application on the iphone/ipod/ipad.

Same goes if you put another file in the resources folder and name it default.png then it will show up as the splash screen that appears while your application is being loaded.

Note: If you are working with a template it will probably already have canned files with these names. Just remove them from the resource folder in xcode and add the new ones. To add the files to your project, drag them into the resource folder within xcode and select the check box for: "Copy items into destination group's folder (if needed)", as well as, make sure in add targets section only the check box for your application name is checked and the radio button "Recursively create groups for any added folders" is selected. This will copy the file(s) into your project directory and they will also appear in the resources folder in xcode. You can then click on them in xcode to see that they are correct.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文