IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Graham Cox
I’m exploring the use of the new IB_DESIGNABLE macro to preview a custom view live in IB. It keeps complaining that my view is taking too long to draw, over 200mS, which seems to be a limit built into IB. However, when I measure the time myself for drawing, it’s nowhere near this long - 10mS

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Kevin Meaney
I am using this in in swift code that then calls into objective-c. I could not get it to work at first but that was because the drawing code was in a objective-c framework where the framework was being loaded with a run path search path that was relative to the application. I had to modify the

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Roland King
On 12 May 2015, at 14:43, Graham Cox graham@bigpond.com wrote: I’m exploring the use of the new IB_DESIGNABLE macro to preview a custom view live in IB. It keeps complaining that my view is taking too long to draw, over 200mS, which seems to be a limit built into IB. However, when

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Michael David Crawford
I haven't tried it myself but this sounds like a bug in IB rather than in your own code. Perhaps you should take a stab at writing a minimal test case, then if that demonstrates that it really is a bug, file a radar. On 5/12/15, Roland King r...@rols.org wrote: On 12 May 2015, at 14:43, Graham

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Graham Cox
On 13 May 2015, at 10:06 am, Kyle Sluder k...@ksluder.com wrote: On Tue, May 12, 2015, at 06:38 PM, Graham Cox wrote: So it looks as if a property that is IBInspectable may be getting incorrectly set to 0 by IB AFTER -initWithFrame: is called, maybe because the user interacts with the

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Kyle Sluder
On May 12, 2015, at 5:49 PM, Graham Cox graham@bigpond.com wrote: On 13 May 2015, at 10:06 am, Kyle Sluder k...@ksluder.com wrote: On Tue, May 12, 2015, at 06:38 PM, Graham Cox wrote: So it looks as if a property that is IBInspectable may be getting incorrectly set to 0 by IB

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Kevin Meaney
On 12 May 2015, at 08:33, Roland King r...@rols.org wrote: On 12 May 2015, at 14:43, Graham Cox graham@bigpond.com wrote: I’m exploring the use of the new IB_DESIGNABLE macro to preview a custom view live in IB. It keeps complaining that my view is taking too long to draw, over

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Graham Cox
On 13 May 2015, at 1:22 am, Sean McBride s...@rogue-research.com wrote: After some difficulty, yes. But it seems to only support direct subclasses of NSView, not NSControl for example. What's your superclass? Well, it is a NSControl subclass (in fact the volume knob discussed in another

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Akis Kesoglou
On 13 Μαΐ 2015, at 02:04, Graham Cox graham@bigpond.com wrote: One possible issue in this case is that the first time -drawRect: for any instance is called, it calls a class method to load the image from a resource, which is then retained indefinitely. There's a method if I remember

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Kyle Sluder
On Tue, May 12, 2015, at 06:38 PM, Graham Cox wrote: So it looks as if a property that is IBInspectable may be getting incorrectly set to 0 by IB AFTER -initWithFrame: is called, maybe because the user interacts with the inspectable properties but doesn’t set a value - rather than leaving it

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Roland King
On 13 May 2015, at 07:04, Graham Cox graham@bigpond.com wrote: On 13 May 2015, at 1:22 am, Sean McBride s...@rogue-research.com wrote: After some difficulty, yes. But it seems to only support direct subclasses of NSView, not NSControl for example. What's your superclass? One

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Graham Cox
On 13 May 2015, at 9:15 am, Akis Kesoglou akiskesog...@gmail.com wrote: On 13 Μαΐ 2015, at 02:04, Graham Cox graham@bigpond.com wrote: One possible issue in this case is that the first time -drawRect: for any instance is called, it calls a class method to load the image from a

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Graham Cox
On 13 May 2015, at 9:37 am, Roland King r...@rols.org wrote: How are you loading the resource? [ NSBundle mainBundle ] .. ] probably won’t work, you need to use bundleForClass. Since that’s now true for resources in frameworks too I’m trying to use that pattern myself. Yes, I’m using

Re: IB_DESIGNABLE - anyone got it to work?

2015-05-12 Thread Sean McBride
On Tue, 12 May 2015 16:43:32 +1000, Graham Cox said: I’m exploring the use of the new IB_DESIGNABLE macro to preview a custom view live in IB. It keeps complaining that my view is taking too long to draw, over 200mS, which seems to be a limit built into IB. However, when I measure the time