If that doesn’t work for you, greate an extension to the class and add your own string tag property. carlImageTag. Then set that whenever you want.
> On Mar 16, 2019, at 8:08 PM, Rob Petrovec <petr...@mac.com> wrote: > > This is expected and documented behavior. From > https://developer.apple.com/documentation/appkit/nscell/1532348-tag?language=objc > > <https://developer.apple.com/documentation/appkit/nscell/1532348-tag?language=objc> > > Setting the value of this property raises with > NSInternalInconsistencyException > <https://developer.apple.com/documentation/foundation/nsinternalinconsistencyexception?language=objc > > <https://developer.apple.com/documentation/foundation/nsinternalinconsistencyexception?language=objc>>. > 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 <newsli...@autonomy.caltech.edu >> <mailto:newsli...@autonomy.caltech.edu>> 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 (Cocoa-dev@lists.apple.com) >> >> 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: >> https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com >> <https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com> >> >> This email sent to petr...@mac.com <mailto:petr...@mac.com> > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com > <mailto:Cocoa-dev@lists.apple.com>) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > <http://lists.apple.com/> > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com > <https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com> > > This email sent to z...@mac.com <mailto:z...@mac.com> _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com