我的 xib 文件在我的 Pod 的 Assets 文件夹中,就像这样。
s.resources = 'Pod/Assets'
xib 文件显示在我工作区的 cocoa pod 的 Development Pods
组中。我正在尝试像这样访问 xib。
[[NSBundle mainBundle] loadNibNamed:@"LabeledTextFieldView" owner:self options:nil];
但是我遇到了以下崩溃
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/jeff.wolski/Library/Application Support/iPhone Simulator/7.1/Applications/775EB653-519B-4FCF-8CD9-92311E205598/LT-Components-iOS.app> (loaded)' with name 'LabeledTextFieldView''
为什么在包中找不到 xib 文件?
最佳答案
s.resources
文件夹不会自动递归到子目录。我必须指定 xib 文件的完整相对路径。
关于ios - 如何从我的 cocoapod 加载 xib 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25433110/