资产目录和 RTL 语言
Asset Catalog and RTL languages
我正在尝试用 RTL 语言制作一个 UIImage
(在 UIImageView
中)翻转(在我的例子中,phone 和应用程序的语言是阿拉伯语)。我在这里使用资产目录时发现了一个有趣的机会:
在 Table 16-1 中有相关的键 language-direction 这似乎正是我的意思寻找。但是,当我相应地更改 Contents.json
时,图像不会翻转。
这是我修改后的 Contents.json
的样子:
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "arrow-icon_512-512@2x.png",
"scale" : "2x",
"language-direction" : "left-to-right"
},
{
"idiom" : "universal",
"filename" : "arrow-icon_512-512@3x.png",
"scale" : "3x",
"language-direction" : "left-to-right"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
有人知道我在这里缺少什么吗?或者这些东西根本不起作用? :)
提前致谢!
这些资产本地化功能似乎只适用于 Xcode >= 8。您甚至不必直接编辑 Contents.json
文件,而是可以使用资产目录本身的选项。
我正在尝试用 RTL 语言制作一个 UIImage
(在 UIImageView
中)翻转(在我的例子中,phone 和应用程序的语言是阿拉伯语)。我在这里使用资产目录时发现了一个有趣的机会:
在 Table 16-1 中有相关的键 language-direction 这似乎正是我的意思寻找。但是,当我相应地更改 Contents.json
时,图像不会翻转。
这是我修改后的 Contents.json
的样子:
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "arrow-icon_512-512@2x.png",
"scale" : "2x",
"language-direction" : "left-to-right"
},
{
"idiom" : "universal",
"filename" : "arrow-icon_512-512@3x.png",
"scale" : "3x",
"language-direction" : "left-to-right"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
有人知道我在这里缺少什么吗?或者这些东西根本不起作用? :)
提前致谢!
这些资产本地化功能似乎只适用于 Xcode >= 8。您甚至不必直接编辑 Contents.json
文件,而是可以使用资产目录本身的选项。