美文网首页
iOS 打包framework相关注意事项

iOS 打包framework相关注意事项

作者: 小灬博 | 来源:发表于2023-08-14 17:22 被阅读0次

在iOS在framework 动态库中,加载图片,加载plist 和加载xib文件,是和普通的加载方式是不一样的。

在iOS开发中,可以通过以下步骤在framework中访问和调用plist文件:

  1. 将plist文件添加到framework项目中,确保将其包含在目标列表中。

  2. 在代码中访问plist文件,可以使用NSBundle类的以下方法:

NSBundle *frameworkBundle = [NSBundle bundleForClass:[self class]];
NSString *plistPath = [frameworkBundle pathForResource:@"example" ofType:@"plist"];
NSDictionary *plistDict = [NSDictionary dictionaryWithContentsOfFile:plistPath];

在iOS开发中,可以通过以下步骤在framework中访问和调用图片:

self.arrowImageView.image = [UIImage imageNamed:@"SettingsResource.bundle/WYX/send_keyboard"

 inBundle: [NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil];

在iOS开发中,可以通过以下步骤在framework中加载xib文件:

NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.di5cheng.WYX-Framework"];

WEAKSELF

XFCameraController *cameraController = [[XFCameraController alloc] initWithNibName:@"XFCameraController" bundle:bundle];;

相关文章

网友评论

      本文标题:iOS 打包framework相关注意事项

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