基础国际化和多个故事板不能正常工作 [英] Base internationalization and multiple storyboard not working right
问题描述
我在xCode 4.6上玩多个故事板和基础本地化。事实上我
I'm playing with multiple storyboards and base localization on xCode 4.6. In fact I
我做了:
1)编辑我的项目信息localisations:选中Use Base Internationalization并添加了语言:英语,中文
1) edit my project infos localisations: checked "Use Base Internationalization" and added Languages: English, Chinese
2)创建一个名为anotherstoryboard.storyboard的新故事板
2) create a new storyboard called "anotherstoryboard.storyboard"
3 )使用Base国际化本地化我的新故事板(文件检查器/本地化 - 本地化)。
3) localize my new storyboard (File Inspector / Localize - Localize) using Base internationalization.
4)在我的应用程序委托中,我动态加载我的本地化故事板,如下所示: / p>
4) in my app delegate, I load dynamically my localized storyboard, like this:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"anotherstoryboard" bundle:nil];
案例1: =>工作
对于我的新故事板(步骤3),我选择Localization Chinese - Interface Builder Cocoa Touch Storyboard
For my new storyboard (step 3) I choose Localization Chinese - Interface Builder Cocoa Touch Storyboard
它有效但现在我必须维护本地化的故事板,用IB编辑它们。我不想要这样的行为,我只想使用基础国际化和本地化.strings文件。
It works but now I have to maintain localized storyboard, editing them with IB. I don't want such behavior, I just want to use base internationalization and localize .strings files.
案例2: =>崩溃
对于我的新故事板(步骤3),我选择本地化中文 - 可本地化的字符串
For my new storyboard (step 3) I choose Localization Chinese - Localizable Strings
该应用程序崩溃说无法找到我的故事板
The app crashes saying it can't find my storyboard
'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'anotherstoryboard' in bundle NSBundle </Users/me/Library/Application Support/iPhone Simulator/6.1/Applications/8E036C84-6058-4420-94B4-1726E1F686AD/HelloWorld.app> (loaded)'
我做错了什么?为什么iOS在案例2中找不到合适的故事板?
What I'm doing wrong ? Why doesn't iOS find the right storyboard in case 2 ?
推荐答案
我刚刚遇到同样的问题(再次)在Xcode 4.6.2中开始本地化一个新的故事板。我检查了所有内容都按照这里和其他地方的建议正确设置,确实是。
I had just run into the same issue (again) after starting localizing a new storyboard in Xcode 4.6.2. I checked everything was setup up properly as suggested here and elsewhere, and indeed it was.
对我来说,通过在Xcode中关闭项目并手动清除问题来解决问题来自Finder的XcodeDerived Data目录(请参阅Xcode首选项)。然后我重新打开了这个项目,做了一个干净的构建,并且故事板得到了正确的编译并按预期工作。
For me, the issue was resolved by closing the project in Xcode and manually clearing the Xcode "Derived Data" directory (see Xcode preferences) from the Finder. Then I reopened the project, made a clean build, and voilá, the storyboard got compiled properly and worked as expected.
这篇关于基础国际化和多个故事板不能正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!