Loading a Localized UIImage

。_饼干妹妹 提交于 2020-01-11 05:23:29

问题


I need to load localized images in my iOS app, but also have to take into account that they might need to be the ...@2x kind. How can I do this?


回答1:


Corrected Answer

[UIImage imageNamed:@"TestImage"] looks first into Resources, if nothing found, it then looks in the lproj dir folders. So you only need to put the localized images into the right folder.

Old Answer

NSLocalizedString should do the trick. See Localizing String Resources.

UIImage *img = [UIImage imageNamed:NSLocalizedString(@"TestImage",@"")];


来源:https://stackoverflow.com/questions/3787751/loading-a-localized-uiimage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!