Re: Setting the tag of an NSCell
Re: Setting the tag of an NSCell
- Subject: Re: Setting the tag of an NSCell
- From: Carl Hoefs <email@hidden>
- Date: Sat, 16 Mar 2019 18:13:32 -0700
Thanks Howard and Rob. I will try both approaches and see what works best.
But, it makes me wonder how Xcode is able to set the tag of NSCells?
-Carl
> On Mar 16, 2019, at 6:10 PM, Howard Moon <email@hidden> wrote:
>
> Either use NSActionCell, or derive your own class from NSCell and implement
> it.
> On Mar 16, 2019, at 6:08 PM, Rob Petrovec <email@hidden> wrote:
>
> This is expected and documented behavior. From
> https://developer.apple.com/documentation/appkit/nscell/1532348-tag?language=objc
>
> Setting the value of this property raises with
> NSInternalInconsistencyException. Subclasses are expected to override this
> property if they support tags
>
> If you want to use tags, you should subclass NSImageCell and implement -tag &
> -setTag: to return your own ivar. Hope that helps.
>
> —Rob
>
>
>> On Mar 16, 2019, at 7:03 PM, Carl Hoefs <email@hidden>
>> wrote:
>>
>> macOS 10.12, ObjC
>>
>> Is it not possible to set the tag of an NSImageCell at runtime?
>>
>> At runtime when I do "myCell.tag = val;" I get a warning:
>> Stub implementation of -setTag by NSCell does nothing.
>>
>> I have an array of 48 NSImageCells. I can't hard-code them in Xcode because
>> don't know the tag values until runtime.
>> How can I accomplish this?
>>
>> -Carl
>>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden