【发布时间】:2014-02-14 10:10:22
【问题描述】:
我将 2 个 xib 文件打包。并且这个包通过拖放添加到项目中。当[super initWithNibName: @ "RUIBrowser.bundle / RUIBrowseriPhoneView.xib" bundle: nil];
应用程序崩溃并出现以下错误:
由于未捕获的异常而终止应用程序 'NSInternalInconsistencyException',原因:'无法加载 NIB bundle:' NSBundle (loaded) 'with name' RUIBrowser.bundle / RUIBrowseriPhoneView.xib'
我做错了什么?
【问题讨论】:
-
尝试
NSBundle * RUIbundle = [NSBundle bundleWithPath:absolutePath];并使用initWithNibName:@"RUIBrowseriPhoneView" bundle:RUIbundle -
你应该使用这个命名约定:RUIBrowserView~ipad.xib 和 RUIBrowserView~iphone.xib。然后你只需在你的代码中写 initWithNibName:@"RUIBrowserView"
标签: ios objective-c xcode