Hi, I've set the cellClass in the +load() method (on the textfield subclass) using setCellClass under mavericks. If memory serves me right, it set the cell in yosemite as well. I was however, creating my cells in code as well. If you are coding in objective-c, then you might be able to set it there (it doesn't seem to be available in Swift).
Regards George On Thu, Oct 8, 2015 at 12:08 PM, Charles Srstka <cocoa...@charlessoft.com> wrote: > > On Oct 7, 2015, at 11:08 PM, Graham Cox <graham....@bigpond.com> wrote: > > > > I’ve tried swapping out the text field’s cell by creating a subclass and > copying all of the original settings into it. Unfortunately that doesn’t > work - just copying across the state isn’t enough to make the replacement > cell look and act like the original text field cell, for some reason - > presumably there’s some order-dependent setup or other hidden stuff in the > ‘real’ text field cell that I can’t get at. > > Did you try fully copying the state by using NSKeyedArchiver? That should > work to replicate all the setup the cell would have done when unarchiving > from the nib: > > + (nullable NSCell *)cellOfClass:(nonnull Class)cellClass > byCloningCell:(nonnull NSCell *)cell { > if (![cellClass isSubclassOfClass:cell.class]) { > return nil; > } > > NSMutableData *data = [NSMutableData new]; > NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] > initForWritingWithMutableData:data]; > > [cell encodeWithCoder:archiver]; > [archiver finishEncoding]; > > NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] > initForReadingWithData:data]; > NSCell *newCell = [[cellClass alloc] initWithCoder:unarchiver]; > > [unarchiver finishDecoding]; > > return newCell; > } > > 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/georgemp%40gmail.com > > This email sent to georg...@gmail.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