Getting IB_DESIGNABLE to work properly

Graham Cox

Hi all,

I’m working on a small custom view project (Mac), and have it working generally quite well.

I decided to make it IB_DESIGNABLE, and that too mostly works - I can see the view in IB rendered with the correct background and border colours, I see all the inspectable properties, and I have established that the internal subviews it creates are constructed. This isn’t easy to determine with IB, because it doesn’t display anything I log; I have to rely on NSBeep() to tell me if a given bit of code ran and so on - this is very unsatisfactory, because I can’t debug the view in the IB case, only in the normal runtime case, where it works perfectly.

The problem I have is that the subviews I create as part of my view exist, but never draw. That means the appearance in IB is blank.

I’m out of ideas on what I need to do to get this to work. 

If anyone’s got a few minutes to take a quick look at the project and see if they can spot the problem, I’d be very grateful:

This shows the difference of the views in IB and at runtime:

Each digit in the display is a separate subview rendering one character, created programmatically when the view is instantiated.


Join to automatically receive all group messages.