Re: why don't custom views have a "tag" in IB?
Re: why don't custom views have a "tag" in IB?
- Subject: Re: why don't custom views have a "tag" in IB?
- From: Matt Neuburg <email@hidden>
- Date: Tue, 21 Nov 2006 17:14:29 -0800
- Thread-topic: why don't custom views have a "tag" in IB?
On or about 11/21/06 4:45 PM, thus spake "James Bucanek"
<email@hidden>:
> Matt Neuburg wrote on Tuesday, November 21, 2006:
>
>> On or about 11/21/06 12:39 PM, thus spake "James Bucanek"
>>> You need to define a custom subclass of NSView
>>> (MyView.h/MyView.m), then import that class definition (MyView.h) into IB.
>>> Create a custom NSView object, then set its custom class to the class of
>>> your
>>> NSView subclass and ... voila! ... all of the outlets and actions in your
>>> custom subclass are now available for binding in IB.
>>
>> Okay, I see the problem. It only works in that direction, and this requires
>> that the IBOutlet hint be used. You cannot, as with other classes, edit the
>> outlet list directly in IB.
>
> Not really. The technique that I described is the one I tend to use, just to
> make sure the definition of my class in IB is consistent with the definition
> on my class in Objective-C. However, there is nothing stopping you from
> defining a new class in IB or randomly altering the outlets and actions in an
> existing class. Simply select the class in the class browser, go to the
> inspector palette, and edit away.
Yes, you're right and I'm wrong. I was misled by certain asymmetries in the
interface. I'm glad we had this little conversation! I learned something
very useful.
Still, as I said before, in this case, this fact does me no good, because if
I copy the NSView by archiving it into an NSData and unarchiving it, the
outlet is lost - it is nil, and therefore unusable, in the unarchived copy.
So I might, after all, end up putting the NSView in a nib of its own, as
Joar says, even though I regard that as unnecessarily heavyweight... m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden