0

How would you call a nib file from within a framework, say:

myFramework/Resources/a.nib

I have the framework built (with iOS-Universal-Framework MK from kstenerud) and installed in the test app, but can't seem to find a way to reference the nib file directly.

[[NSBundle mainBundle] pathForResource:@"BarViewController_iPhone" ofType:@"nib"]
returns nil.

barViewController = [[BarViewController alloc] initWithNibName:@"BarViewController_iPhone" bundle:nil]; also does not work.

where the nib file name is BarViewController_iPhone.nib. It returns nil.

I also tried to reference my framework with [NSBundle bundleIdentifier], but my framework has a null id. How do I set the id when I build the framework?

Any suggestions would be greatly appreciated!

Nick Weaver
  • 47,228
  • 12
  • 98
  • 108
Lu Gan
  • 15
  • 1
  • 4
  • his question here should answer yours : http://stackoverflow.com/questions/707429/can-you-reference-xib-files-from-static-libraries-on-the-iphone – Sebastian Flückiger Feb 27 '12 at 21:12
  • 1
    @Sebastian Flückiger: you should add your comment as an answer so this question can be answered/closed. The link is very good. – Nick Weaver Feb 27 '12 at 21:17

1 Answers1

0

Reposting comment as answer:

For this question already exists a thread, that contains a lot of useful information & answers to this problem.

Read about it here: Can you reference Xib files from static libraries on the iPhone?

Community
  • 1
  • 1
Sebastian Flückiger
  • 5,525
  • 8
  • 33
  • 69
  • Sebastian, Thanks for answering! I have read through that post and a couple others, and started on the path of using the framework. But I still can't seem to reference the resource file after my framework is built and included. Would the resource file of a included framework be in the main bundle or in its separate bundle? – Lu Gan Feb 28 '12 at 00:44
  • it would be in the framework bundle =) its explained greatly on this article: http://cocoadevcentral.com/articles/000064.php you need to fetch the nib from the frameworks bundle =) – Sebastian Flückiger Feb 28 '12 at 09:17