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

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

问题描述

我正在尝试根据设备语言加载播放"图像(uiimageview).

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

在我的 AppBundle 中有文件夹 en.lproj(english) 和 es.lproj(spanish),每个文件夹都有一个 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).

我知道如何使用 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 等),然后我将所有可本地化的图像拖到各自的目录中,然后将所有新图像添加到 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天全站免登陆