I'm trying to create a nib that contains a view that will be embedded in a TableViewCell. I've created the interface and implementation files, ResultCell.h
and ResultCell.m
. They're stock, out-of-the-box, no code changes.
I then create an empty XIB file, and drag a UIView onto it. Then I click File's Owner, and set the type to ResultCell
. I click the view, and set its class to also be ResultCell
.
Here are the problems I have:
ResultCell.h
file doesn't appear when I'm viewing the ResultCell.xib file. I have to force it to load by clicking on Automatic and selecting the file.I've tried creating and re-creating the view, and it's just not working, and I've started to lose my patience. Any help would be very, very appreciated!
In fact, the acronym "NIB" comes from "NeXTSTEP Interface Builder", and "XIB" from "Xcode Interface Builder". NIBs and XIBs are effectively the same thing: XIBs are newer and are used while you're developing, whereas NIBs are what get produced when you create a build.
Application interface created with Interface Builder, a graphical editor for designing and testing user interfaces; saved in a text-based flat-file format, introduced in Interface Builder 3.0. NOTE: XIB files are also called "development-time format" files.
XIB and Storyboard are used for creating interfaces for users. One important point is,xibs are used for creating a single view(it has single file owner at the top of the xib file), but in-case for viewcontroller, multiple screens can be added and its flow can also be monitored(it has separate file owners).
I got into a similar state just today. It was very odd: I could attach any XIB (new or existing) to any already-existing ViewController class in the project, but I could not create a new ViewController and have it attach properly to any XIB. The "assistant" functionality didn't work, nor did the IB-to-headerfile-connection functionality.
Closing the project and re-opening did not fix it.
Quitting XCode and restarting did not fix it.
Creating a new project and testing the functionality worked fine, which led me to believe there was something corrupt in some cache somewhere.
My solution
Incidentally, just running a full clean did not seem to clear things up. I had to trash the derived data. I'm certain I got into this position because of git games I was playing, but I had no idea how to get out, because even switching back to earlier git revisions didn't help. (That was a big clue also that it was something untracked by the project itself.)
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