Re: Attributed strings in NSTableViews
Re: Attributed strings in NSTableViews
- Subject: Re: Attributed strings in NSTableViews
- From: Andy Lee <email@hidden>
- Date: Sun, 30 Jun 2013 15:48:05 -0400
On Jun 30, 2013, at 2:44 PM, Kyle Sluder <email@hidden> wrote:
> On Jun 30, 2013, at 6:04 AM, Peter Hudson <email@hidden> wrote:
>
>>
>> I then append a second attributed string to the first - with very similar attributes as the first.
>> After this, when the row is selected, the system no longer reverses out the text color as it did previously.
>
> Text drawing will only reverse the colors of text if the entire string is drawn in NSControlTextColor. (I've filed a Radar on this opaque, undocumented, uncustomizable behavior.)
I ran into similar stubbornness when trying to use a custom color for the title of an NSButton when it is disabled. My workaround, based on an answer I found on StackOverflow, was to override the cell's drawTitle:withFrame:inView: method.
.m: <https://github.com/aglee/appkido/blob/master/src/CustomViews/AKButtonCell.m>
.h: <https://github.com/aglee/appkido/blob/master/src/CustomViews/AKButtonCell.h>
Maybe the same technique would work for you. You'd have to figure out how to reverse the color yourself, but at least you'd have complete control over the string's appearance.
--Andy
_______________________________________________
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