I have made one static library which contains some nibs. When I try to load those nib files, I am getting Could not load NIB in bundle: 'NSBundle. If anyone knows how to do this, it will be very helpful. Thanks
Asked
Active
Viewed 1,390 times
2
-
can you post your code? How did you invoke xib file? – Niru Mukund Shah Apr 04 '13 at 09:43
-
[[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentViewController:vcObj animated:YES completion:nil]; – BhushanVU Apr 04 '13 at 09:45
-
code to load nibs is right but they are not getting linked or not getting referred by main project... – BhushanVU Apr 04 '13 at 09:46
-
yes, & how did you initialize your "vcObj"? – Niru Mukund Shah Apr 04 '13 at 09:46
-
vcObj=[[MyViewController alloc]initWithNibName:@"MyViewController" bundle:nil]; vcObj.modalTransitionStyle=UIModalTransitionStyleCrossDissolve; – BhushanVU Apr 04 '13 at 09:49
-
2Read this, [Can we reference Xib files from static libraries][1] [1]: http://stackoverflow.com/questions/707429/can-you-reference-xib-files-from-static-libraries-on-the-iphone – Vedchi Apr 04 '13 at 09:59
3 Answers
3
Existed answer : Can you reference Xib files from static libraries on the iPhone?
No you can't use this way,
A static library is a file that contains classes. It does not contain other files, it is essentially a database of compiled code.Even it is possible to put the data for the xibs in static library,But Xcode won't recognize that it was in there.
0
when you allocate your controller init it with nib from main bundle.
[initWithNibName:@"Your nib.." bundle:[NsBundle MainBundle]]

Agent Chocks.
- 1,312
- 8
- 19
0
If you are not getting linked or not getting referred by main project, then checkout following steps once, & make sure that You are not missing anything
- Go to your xib (i.e. MyViewController)
- Open File Inspector
- Select File's Owner
- Select 3rd tab from File's Inspector
- Go into Custom Class section
- Check the class name

Niru Mukund Shah
- 4,637
- 2
- 20
- 34