我是一个初级程序员,如果这听起来很愚蠢,很抱歉。我知道我必须通过媒体库将图像放入 Xcode...但是媒体库在哪里?我将图像文件放入创建项目时创建的文件夹中,但它没有显示出来。我在那里有两种格式的相同图像:PNG 和 JPEG。“媒体库”的位置在哪里?
2 回答
What do you mean with Media Library? The pane in Interface Builder on the bottom right? That just lists all the media items that are part of your current project or workspace.
You have to add the images to your project, if you want to use them in your app. The easiest way is to drag them in one of the Groups in Xcode's Project Navigator tab on the left side. Make sure you check your target (this will make Xcode copy the images into your app's resources on compile time).
如果您有 png 或 jpg,首先,您需要创建一个图像集,然后重新启动 xcode,它将在媒体库中可用。要创建图像集,您需要在左侧导航窗格中选择 Assets.xcassets,然后在工具栏中选择编辑器 -> 添加资产 -> 新图像集。为您的图像命名并选择渲染作为模板图像。