Re: Getting IB_DESIGNABLE to work properly


Quincey Morris
 

On Mar 4, 2018, at 14:10 , Graham Cox <graham@...> wrote:

the IB ‘agent’ for previewing an IB_DESIGNABLE view directly calls -drawRect: on the view - it does not use the proper hierarchical view rendering process

An interesting observation. I went back to your test project and made the digit-array drawRect call drawRect on the subview, and they draw in IB!

Unfortunately, they draw in the wrong place. If you can figure out why their frame is not what you originally set (or compensate somehow), you presumably could get this to draw right.

This assumes that your digit-array view knows it’s drawing for IB, and it *can* know that. There’s a “prepareForInterfaceBuilder” method that’s supposedly called to let you know you’re in that environment.

Join {cocoa@apple-dev.groups.io to automatically receive all group messages.