The next part of the interface that we want to change is the color of the text for the checkbox. While the text looks fine in a standard window, it is difficult to read black text on the black background of a HUD window. While the NSButton
object does not contain its own method for setting text color, we can use what we have learned about Categories to create our own method.
The first thing that we need to do is create a new file using the Objective-C category template. We will call our category
TextColor
and it will be a category on NSButton. Do that now. The result should be that two new files, namedNSButton+TextColor.h
andNSButton+TextColor.m
, will be created and displayed in the project navigator.In the file named
NSButton+TextColor.h
, add the following program code to declare the interface method that can be invoked on anNSButton
to set its text color.@interface NSButton (TextColor) // The method to set the text color - (void)setTextColor:(NSColor...