My xib files are in the Assets folder of my Pod like this.
s.resources = 'Pod/Assets'
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];
But I get the following crash
*** 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''
Why is the xib file not found in the bundle?
What are XIB files? From the point of view of the UI designer, XIB files contain the views or windows that you design in Interface Builder – the controls, their layout and properties, and their connections to your code. It is important to understand that on a technical level, XIB files are stored object graphs.
Once you decided on a type of UI Controller (View, TableView, CollectionView, etc.), go into File > New > File (⌘N) and select Cocoa Touch Class . Click next. Now we are going to select the subclass and give the new UI Element a name. Let's call it RateMe, with the type of UIViewController .
The s.resources
folder will not automatically recurse to subdirectories. I had to specify the full relative path to the xib files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With