我正在使用 xCode 4.6 上的多个故事板和基础本地化.其实我
I'm playing with multiple storyboards and base localization on xCode 4.6. In fact I
我做到了:
1) 编辑我的项目信息本地化:选中使用基础国际化"并添加语言:英语、中文
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) 在我的应用委托中,我动态加载我的本地化故事板,如下所示:
4) in my app delegate, I load dynamically my localized storyboard, like this:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"anotherstoryboard" bundle:nil];
案例 1: => 有效
对于我的新故事板(第 3 步),我选择本地化中文 - 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 步),我选择 Localization Chinese - Localizable Strings
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.
这篇关于基础国际化和多个故事板无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!