xcode - 加载具有相同名称的本地化图像,而不是使用nslozalicedstring [英] xcode - load localized images with the same name, not using nslozalicedstring

查看:80
本文介绍了xcode - 加载具有相同名称的本地化图像,而不是使用nslozalicedstring的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试加载播放图像(uiimageview),具体取决于设备语言。

I'm trying to load a "Play" image(uiimageview) depending on the device language.

在我的AppBundle中有文件夹,en.lproj(英语)和es.lproj(西班牙语)每个都有一个Play.png图像(一个用英语,一个用西班牙语)。

In my AppBundle there are to folders, en.lproj(english) and es.lproj(spanish) with a Play.png image each one(one in english and one in spanish).

我知道如何使用Play加载本地化图像一个Localizable.strings和具有不同名称的图像,例如,Play_en.png和Play_es.png ...使用NSLocalizedString或类似的东西。

I know how to load localized images using a Localizable.strings and images with different name, for example, Play_en.png and Play_es.png... using NSLocalizedString or something like that.

但是,有没有办法加载具有相同名称的本地化图像?(主要是为了维护一个良好的组织)

But, is there any way to load that localized image with the same name? (primarily to maintain a good organization)

这是xcode的外观:
http://a.imageshack.us/img51/8999/1007230001.png

This is how looks in xcode: http://a.imageshack.us/img51/8999/1007230001.png

感谢您阅读;)

推荐答案

什么我做的是创建我的本地化目录(en.lproj,fr_FR.lproj等)然后我将拖动所有localizabl将图像放入各自的目录中,然后将所有新图像添加到Xcode项目中。 Xcode足够聪明,可以在多个.lproj目录中存在相同的图像名称

What I do is create my localizable directories (en.lproj, fr_FR.lproj, etc) then I will drag all the localizable images into their respective directories, then add all the new images to the Xcode project. Xcode is smart enough to realize that the same image name exists in multiple .lproj directories

这篇关于xcode - 加载具有相同名称的本地化图像,而不是使用nslozalicedstring的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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