美文网首页
静态库和framework的封装

静态库和framework的封装

作者: liboxiang | 来源:发表于2019-02-20 09:45 被阅读4次

    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;
    }
    

    相关文章

      网友评论

          本文标题:静态库和framework的封装

          本文链接:https://www.haomeiwen.com/subject/gnyhkftx.html