> On Apr 5, 2017, at 8:38 AM, Keary Suska <cocoa-...@esoteritech.com> wrote: > >> >> On Apr 4, 2017, at 4:34 PM, Daryle Walker <dary...@mac.com >> <mailto:dary...@mac.com>> wrote: >> >> >>> On Apr 4, 2017, at 9:57 AM, Keary Suska <cocoa-...@esoteritech.com >>> <mailto:cocoa-...@esoteritech.com>> wrote: >>> >>> >>>> On Apr 3, 2017, at 5:40 PM, Daryle Walker <dary...@mac.com >>>> <mailto:dary...@mac.com>> wrote: >>>> >>>> Is there a way to affect the font of a table cell via Bindings? The few >>>> times I tried, at the NSTextField level (NSTableCellView does not have any >>>> font-related Bindings), resulted in Xcode’s XIB compiler jamming. (I >>>> always cancel and take out the change.) >>> >>> Remember that NSTableCellView subviews cannot bind outside of the >>> NSTableCellView. The easiest approach is to have the font a property on the >>> model object set as NSTableCellView’s objectValue, and bind to that. >> >> My model just stores strings. > > So? Do you have a religious belief against mixing class properties? (Sorry, > couldn’t resist ;-) If the issue is persistence, the value would be transient > and not stored (as it is stored elsewhere). > >> So, I would have to make a value-transformer that reads the font preference >> from the user-defaults and create a attributed-string with the model string >> in the desired font? > > You could, but you wouldn’t be able to easily update the UI when the font is > changed.
Actually, while NSTableCellView won’t bind to *most* things outside of the table view, there is an exception for the table’s delegate. So, if you set the table’s delegate to File’s Owner, and then bind the NSTableCellView’s ‘font’ binding to File’s Owner, it should work.* *But only in a XIB file. In a storyboard, the XIB compiler will get stuck in an infinite loop which will continue even after you click the “Stop” button, grabbing more and more RAM surreptitiously in the background until your Mac runs out of swap space and you’re forced to do a hard reboot. Hooray for Xcode! Charles _______________________________________________ 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