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 12:57:21 -0800
- Thread-topic: why don't custom views have a "tag" in IB?
On or about 11/21/06 12:39 PM, thus spake "James Bucanek"
<email@hidden>:
> Matt Neuburg wrote on Tuesday, November 21, 2006:
>
>> On Tue, 21 Nov 2006 20:22:24 +0100, j o a r <email@hidden> said:
>>>
>>> On 21 nov 2006, at 20.10, Matt Neuburg wrote:
>>>
>>>> Why doesn't the Attributes inspector for a custom view in IB have a
>>>> "tag"
>>>> field? A custom view is a view, so it can have a tag - right? And why
>>>> wouldn't I want to set that tag in IB?
>
> As others have pointed out, Tag is not a settable property in NSView. It is up
> to a subclass to either define it as a constant or provide some means of
> settings it. NSControl implements a setTag: which is why all descendants of
> NSControl have settable tags in IB.
>
>>> While NSView have a -tag method, it's actually only with NSControl
>>> (and descendants) that you find both -tag and -setTag:, so I'm not
>>> surprised that it's "missing" in IB.
>>>
>>>> If I can't set a tag, it's hard to tell one custom view from another.
>>>>
>>>> The difficulty is compounded by the fact that a custom view cannot
>>>> have outlets.
>>>
>>> If you set it to be of a custom subclass (using the inspector) that
>>> have outlets, I'm pretty sure that it would work.
>>
>> I'm pretty sure that it doesn't, so please actually try it in your copy of
>> IB and tell me what you see.
>
> It most certainly does. 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.
Furthermore, these outlet settings seem to be lost if you archive the view
to data and unarchive it. Odd. 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