开发者

Load XIB from Custom Bundle via Static Library

I want to load a XIB from a CFBundle, via some code in a Static Library.

Example:

MyViewController * foo = [[Static Library] instance] getMyViewController];

So I have a MyViewController .xib in a CFBundle I manually create, in it's Resources dir.

But if I try to load it via [[MyViewCo开发者_如何学编程ntroller alloc] initWithNibName:@"MyViewController" bundle:MyBundlePointer] in getMyViewController I get NSInternalInconsistencyException.

Any idea? I am more or less stumped on this one. Not sure it is even possible to do this.


I'm currently having exactly the same issue with Monotouch and that's why I found your question. I get the very same exception as you do. This makes me assume that I'm not facing a Monotouch issue but a basic (mis)behavior of XIBs/Cocoatouch.

So the answer is: no, it is not possible. Very sad though.

René


this may not be your specific issue, but it is potentially an issue:

CFBundle is not toll-free-bridged with NSBundle. since you used the term CFBundle in your description, i am wondering if you're passing a CFBundle, rather than an NSBundle.

these are two distinct types and you'll need to explicitly create an NSBundle instance because you can't just cast a CFBundleRef as a NSBundle as you can with CF/NS-String, Array, Data, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜