iOS从捆绑包中加载资源

时间:2012-09-14 14:36:23

标签: bundle ios6

我对Xcode只是一个小问题。从现有的项目中我得到了一个静态库(带有源代码)和一个* .bundle(里面只有一个故事板和故事板中使用的图像)。在第二个项目中,我已经链接了库(它正常工作)和bundle(在构建阶段的复制包资源中有* .bundle)。当我尝试加载故事板时,它会加载它但没有图像。 这里有我称之为故事板的代码:

UIStoryboard *story=[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle bundleWithIdentifier:@"MYCOMPANY.BUNDLE1"]];

MyViewController *libViewContr= [story instantiateInitialViewController];

libViewContr.modalPresentationStyle = UIModalPresentationFullScreen;                
[self presentViewController:libViewContr animated:YES completion:nil ];

谢谢大家。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。我发现在构建bundle时png资产被压缩为.tiff格式。您可以通过将目标设置中的“将高分辨率图稿组合”设置为FALSE / NO。

来禁用此功能