静态库和framework的封装

2019-02-20  本文已影响4人  liboxiang

http://www.cocoachina.com/bbs/read.php?tid-282490-page-1.html

注意点:

+(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;
}
上一篇 下一篇

猜你喜欢

热点阅读