3
我有2套iPhone应用程序本地化图像。我应该如何放置图像?我怎样才能加载到应用程序?iOS:管理本地化图像
的文件夹结构如下:
For English version:
/MyApp/en.lproj/Localizable.strings , InfoPList.strings
/MyApp/en.lproj/*.png (images)
For Traditional Chinese version:
/MyApp/zh-Hant.lproj/Localizable.strings , InfoPList.strings
/MyApp/Resources/*.png (images)
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *locale = [[defaults objectForKey:@"AppleLanguages"] objectAtIndex:0];
NSString* path= [[NSBundle mainBundle] pathForResource:locale ofType:@"lproj"];
NSBundle* languageBundle = [NSBundle bundleWithPath:path];
SomeViewController *vc = [[SomeViewController alloc] initWithNibName:@"SomeViewController" bundle:languageBundle];
我想用相同的文件名两个组图像,使其自动加载。可能吗?
现在我遇到一个问题。在调试控制台中,它说:
NSBundle </Users/SomeUser/Library/Application Support/iPhone Simulator/5.0/Applications/1DC22505-1E78-4B5E-A794-DBF72DC786AE/MyApp.app/zh-Hant.lproj> (not yet loaded)
我该如何解决它?
哪里应该把图像的图像吗?相同的文件夹(全部在'/ MyApp/Resources /'或者他们的'.lproj')? – Raptor 2012-02-22 06:54:16
在Resources文件夹中 – 2012-02-22 06:54:47
如果我在视图控制器的初始化中将bundle设置为'nil',则在重新启动应用程序后,图像效果不错。有什么方法可以在不重新启动的情况下更改应用图片吗? – Raptor 2012-02-22 07:40:32