Re: Getting IB_DESIGNABLE to work properly
On 4 Mar 2018, at 4:14 pm, Quincey Morris <quinceymorris@...> wrote:Thanks for having a look,
I see what you’re saying, but IB has to instantiate the view (at least once) to capture what it renders. It must also redo this capture whenever any of the properties change. I can prove that by adding NSBeep() to the -drawRect method - it beeps on every property change. By the same approach I know that my subviews are created - but a beep in their -drawRect: method doesn’t occur.
If I have this code in my view’s -drawRect:, it also beeps:
if( self.subviews.count > 8 )
This demonstrates that the subviews are there, so it’s not that IB is forcing the subviews to be empty after instantiating the view, it’s just somehow preventing them rendering - I wondered maybe by invoking -drawRect: instead of -display. I can’t think why they’d do this, it makes the feature a lot less useful than it could be. However, even if I call -display on all the subviews myself as part of -drawRect:, they don’t draw, so there’s something tricky going on.
Not worth the rewrite for this extra nicety, TBH.