Skip navigation.
 
mlRe: Interface Builder 3 and Custom Views
FROM : Jonathan Hess
DATE : Sun Jan 20 19:31:30 2008

Hey Fabian -

The fact that you cannot connect the custom view's action is a bug in 
Interface Builder 3.0. You should be able to apply the connection. The 
good news is that this particular bug is already been fixed.

When you set the 'custom class' in interface builder, all that is 
happening is that a piece of meta-data is being attached to the object 
that says "At runtime make this an instance of X instead of Y." The 
change only happens at runtime though. So, when you start with a 
custom view in IB, and change it's custom class to "MyView", for all 
of design time, the object is still an instance of "CustomView". It 
only becomes a "MyView" at runtime. The same goes for NSButton's, if 
you change the custom class of an NSButton to a "MyButton", for the 
entire time that the button is in IB, it is a "NSButton", only at 
runtime does it become a "MyButton."

The benefit of applying the custom class information of "MyButton" to 
an NSButton, instead of a custom view, is that you can still use the 
button inspector in IB to set your button's inherited properties. 
You'll also be able to work around the action connecting bug, and in a 
couple of minutes, you'll probably also realize that you need to set 
the custom class on your button cell too. With an NSButton instead of 
an NSCustomView, this will all be much easier.

Good Luck -
Jon Hess


On Jan 20, 2008, at 2:07 AM, [nexUmoja] Fabian Jäger wrote:

> With Interface Builder 2 it worked without any problems to use a 
> Custom View and change its class to my NSButton subclass...
> I already tried to change the class of an NSButton in Interface 
> Builder 3 to my subclass, but unfortunately it does not change its 
> appearance accordingly. It seems not to change the class of the 
> button :-(
>
> Fabian
>
> Am 20.01.2008 um 10:49 schrieb Nick Toumpelis:
>

>> As far as I can tell, CustomView is only suitable for subclasses of 
>> NSView. NSButton is further down the line of inheritance and IB 
>> doesn't work with it like it does normally ...
>>
>> What about, starting with NSButton and specifying the Class value 
>> as your own subclass?
>>
>> Nick

> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlInterface Builder 3 and Custom Views [nexUmoja] Fabia… Jan 20, 09:33
mlRe: Interface Builder 3 and Custom Views Mike Abdullah Jan 20, 10:30
mlRe: Interface Builder 3 and Custom Views j o a r Jan 20, 10:35
mlRe: Interface Builder 3 and Custom Views Nick Toumpelis Jan 20, 10:49
mlRe: Interface Builder 3 and Custom Views [nexUmoja] Fabia… Jan 20, 11:07
mlRe: Interface Builder 3 and Custom Views Nick Toumpelis Jan 20, 11:43
mlRe: Interface Builder 3 and Custom Views Jonathan Hess Jan 20, 19:31