I'm using Xcode 6.1.1, and cannot select my custom class from the drop down. Because of this, I believe it is causing several other related issues (see below).
Symptoms:
- When using the IB drop down to choose a custom class, none of the custom classes appear.
IB_DESIGNABLE
andIBInspectable
do not work: When selecting the control in IB, the "Designable" status does not appear; none of the inspectable properties appear either. Debug selected views option is grayed out when selecting a view which is defined asIB_DESIGNABLE
.- Ctrl-dragging items to create connections (IBOutlet and IBAction) from IB to source code occasionally doesn't allow you to "drop" the connection into the class's source code (as if there is a class mismatch). (Note: This assumes you manually typed in the class name in the Custom Class section.)
- Suspected to be related: WatchKit: unable to find interface controller class
How can I fix this?
This is what worked for me:
I somehow lost the
view
reference, so all i did was to drag from a little circle "New Referencing Outlet" to the main view of the .xib, and BOOM!Things that worked:
Things I tried that didn't work (but have worked for others):
Things I tried that didn't work:
View
useABCTestView
).Related discussions:
Here are some possible solutions:
Manually type the name of your custom class instead of trying to find it in the dropdown. Sometimes IB will autocomplete the name of the class as you type, especially if you follow Apple's conventions, i.e. YourView as a subclass of NSView.
If the view does not begin as a Custom View either dragged from the Object library or created from Editor > Embed In > ..., for some reason changing the Custom Class in the Identity inspector doesn't make a difference. To fix this, right-click the .xib and choose Open As > Source Code. Search for the view you want to fix (giving your view a label that is easily identifiable in IB will make this easier). You will find an entry like this:
Change
view
tocustomView
so that the entry resembles:then right-click the .xib again and choose Open As > Interface Builder XIB Document and you should now see a Designables entry under Custom Class in the Identity inspector of IB and Debug Selected Views will be available under the Editor menu.
Doesn't sound like your exact problem, but on a dual-monitor/multi-monitor setup, if IB is on a different monitor from the source code window, go to Apple menu > System Preferences... > Mission Control and uncheck Displays have separate Spaces. This may have some visual side-effects (like window drop-shadows bleeding into other monitors) but it will fix the problem of ctrl-dragging onto a separate monitor.
This wasn't your specific situation but I was in a similar "rip my hair out" moment. When creating custom controller classes and using the interface builder, you must make sure to click the yellow button at the top of the view you're working with (the view controller button). Otherwise the custom ViewController class won't show up in the custom class drop down menu within the identity inspector.
One thing that worked for me after inexplicably seeing the issue where the "Designables" row would not appear in the Custom Class section of the Identity Inspector:
Before (not functioning: Designables did not appear and Interface Builder did not render my class):
After (functioning: Designables did appear and Interface Builder did render my class):
So it appears that Xcode is very sensitive to the order of things.