如何从我的cocoapod加载xib文件? [英] How do I load a xib file from my cocoapod?

查看:467
本文介绍了如何从我的cocoapod加载xib文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的xib文件在我的Pod的Assets文件夹中。

My xib files are in the Assets folder of my Pod like this.

s.resources = 'Pod/Assets'

xib文件显示在我的工作区的 Development Pods 可可豆荚组。我正在尝试像这样访问xib。

The xib files show up in my workspace in the Development Pods group of the cocoa pod. I'm trying to access the xib like this.

[[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文件?

Why is the xib file not found in the bundle?

推荐答案

s.resources 文件夹不会自动递归到子目录。我必须指定xib文件的完整相对路径。

The s.resources folder will not automatically recurse to subdirectories. I had to specify the full relative path to the xib files.

这篇关于如何从我的cocoapod加载xib文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆