简体   繁体   English

在Playground上添加iOS资源

[英]Adding iOS resources on Playground

According to documentation : 根据文件

IOS resources should be added inside the App_Resources\\ios folder in your app. IOS资源应添加到应用程序的App_Resources \\ ios文件夹内。 You can use @1x, @2x and @3x suffixes to target devices with a specific screen scale. 您可以使用@ 1x,@ 2x和@ 3x后缀来定位具有特定屏幕比例的设备。 Here is a list of devices for each scale factor: 以下是每个比例因子的设备列表:

@1x - iPad 2 and iPad mini (1st Generation) @2x - iPhone 4s, iPhone 5, iPhone 6, iPad (retina) @3x - iPhone 6 Plus @ 1x-iPad 2和iPad mini(第一代)@ 2x-iPhone 4s,iPhone 5,iPhone 6,iPad(视网膜)@ 3x-iPhone 6 Plus

However, if I try to name a file photo@1.png in Playground I receive an error: 但是,如果我尝试在Playground中命名文件photo@1.png,则会收到错误消息:

The specified file name is invalid. 指定的文件名无效。 Only alphanumeric characters (including "_", "-" and ".") are allowed. 仅允许使用字母数字字符(包括“ _”,“-”和“。”)。

How can I solve this? 我该如何解决?

When working with Xcode Playgrounds, you can use the following workflow to rename images to your desired format: 使用Xcode Playgrounds时,可以使用以下工作流程将图像重命名为所需的格式:

  1. Press ⌘1 to open the Project Navigator 按⌘1打开项目导航器

  2. Drag your image into the Resources folder (it appears, but is blurred out as long as you don't have any files in it 将您的图像拖到“资源”文件夹中(它会出现,但只要其中没有任何文件,它就会被模糊掉

  3. Rename it to have @1x.png etc. at the end 重命名为末尾有@ 1x.png等

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM