简体   繁体   English

根据我的Xamarin Forms iOS应用中的文化更改启动屏幕故事板图像

[英]Change a launch screen storyboard image based on culture on my Xamarin Forms iOS app

I have followed a number of tutorials on the web to try and make an image on my storyboard launch screen change based on the culture that the iPhone is set to. 我遵循了网上的许多教程,尝试根据iPhone所设置的文化在故事板启动屏幕上进行更改。 I can make the text inside the app change so I know the culture is being set correctly, and that I have defined the cultures in the project settings but an image on the launch storyboard always shows the English picture. 我可以更改应用程序内的文本,以便知道正确设置了区域性,并且已经在项目设置中定义了区域性,但是启动情节提要板上的图像始终显示英语图片。

My storyboard (created as a Launch Screen in Add, New File) is in the iOS project root and I have a Resources folder which contains folders named en.lproj, fr.lproj and de.lproj. 我的情节提要板(在“添加”,“新文件”中作为“启动”屏幕创建)位于iOS项目的根目录中,我有一个Resources文件夹,其中包含名为en.lproj,fr.lproj和de.lproj的文件夹。 I have an image in each of these folders called Header.png which is slightly different based on the language. 在每个这些文件夹中都有一个名为Header.png的图像,该图像根据语言而略有不同。

From what I have read, setting the image property of the image control on the storyboard to Header.png should show the english version based on it being my default developer culture (which works - this does happen), then should pick the same image from the relevant folder based on the culture changing and the app re-starting. 根据我的阅读,将故事板上的图像控件的image属性设置为Header.png应该显示英语版本,因为它是我的默认开发人员文化(有效-确实会发生),然后应该从中选择相同的图像根据文化的变化和应用的重新启动,相关的文件夹。 This isn't happening unfortunately, it always pulls the english one back. 不幸的是,这并没有发生,它总是使英语退缩。

I have tried putting the storyboard in a Base.lproj folder in the project root, and in a Base.lproj folder in the Resources folder and have tried moving the language folders (de.lproj, etc) out of the Resources folder to the root but none of these seemed to change anything. 我试过将情节提要放在项目根目录的Base.lproj文件夹中,并在Resources文件夹的Base.lproj文件夹中,并尝试将语言文件夹(de.lproj等)从Resources文件夹移至根目录但是这些似乎都没有改变任何东西。

I am using the iPhone 6 emulator and am developing in Xamarin studio (latest alpha version) 我正在使用iPhone 6模拟器,并且正在Xamarin Studio(最新的Alpha版)中进行开发

Does anybody have any suggestions as to where I might be going wrong? 有人对我可能会出错的地方有任何建议吗? I've been working on this all day (and last night) and it's driving me nuts :( 我整天都在工作(昨晚),这让我发疯了:(

Thanks in advance, 提前致谢,

Alan 艾伦

I believe the setup for launch storyboards / screens differs to the general storyboards you use for your UI. 我相信启动情节提要/屏幕的设置不同于您用于UI的常规情节提要。

I have tried localising the images on both a Xamarin project and an Xcode project, neither would localise the image on the launch screen - but once launched the same image would be localised on the main storyboard. 我曾尝试在Xamarin项目和Xcode项目上本地化图像,但都不会在启动屏幕上本地化图像-但是一旦启动,同一图像将在主情节提要板上本地化。

Try creating a separate launch storyboard for each localisation as putting each one in it's respective .lproj folder. 尝试为每个本地化创建一个单独的启动情节提要板,将每个放到各自的.lproj文件夹中。

https://developer.xamarin.com/guides/ios/advanced_topics/localization_and_internationalization/#Launch_Images https://developer.xamarin.com/guides/ios/advanced_topics/localization_and_internationalization/#Launch_Images

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

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