http://www.cocoachina.com/bbs/read.php?tid-282490-page-1.html
注意点:
- bundle里面不要带plist文件.build setting -> packaging->info.plist file设置为空。否则提审的时候可能会报Executable file相关的错误
- bundle中资源的获取方法
+(NSBundle*)getResourcesBundle
{
return [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"JYSDK_IMAGE" ofType:@"bundle"]];
}
+ (NSBundle *)getNibBundle
{
return [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"JYSDK_XIB" ofType:@"bundle"]];
}
+ (UIImage *)imageWithName:(NSString *)imageName
{
NSBundle *bundle = [self getResourcesBundle];
return [UIImage imageWithContentsOfFile:[bundle pathForResource:imageName ofType:@"png"]];
}
+ (UIView *)loadNibViewWithName:(NSString *)nibName owner:(nullable id)owner
{
NSBundle *bundle = [self getNibBundle];
return [bundle loadNibNamed:nibName owner:owner options:nil].lastObject;
}
网友评论