MountainLion 10.8.5, Xcode 5.0.2
My code creates some objects in code rather than using IB.
This creates an NS Button, tests for the currentControlTint and the Cell 
controlTint.

@interface Document : NSDocument
………
@property NSButton *Cancel;
@property NSButton *Check;
@end

@implementation Document
……………
_Cancel= [[NSButton alloc]initWithFrame:theButtonFrame];

    NSString *tintImageName;
if ([NSColor currentControlTint] == NSGraphiteControlTint)
    tintImageName=@"GraphiteImage";
else
    tintImageName=@"AquaImage"; // This is the currentControlTint

    NSString *cellTintText;
    NSControlTint cellTint = [_Cancel.cell controlTint];
if ( cellTint == NSBlueControlTint)
    cellTintText = @"AquaTint";
else
    cellTintText = @"GraphiteTint"; // This is the cell controlTInt
……………
@end

The documentation in the NSCell Class Reference states:
Designated Initializers
When subclassing NSCell you must implement all of the designated initializers. 
Those methods are: init, initWithCoder:, initTextCell:, and initImageCell:.

and later on
Sets the receiver’s control tint.
 - (void)setControlTint:(NSControlTint)controlTint
 Parameters
 controlTint
 An Designated Initializers value that specifies the tint of the receiver.

Changing the instantiation code to this makes no difference:
    _Cancel = [[NSButton alloc]init];
    [_Cancel setFrame:theButtonFrame];
    [_Cancel setNeedsDisplay:YES];

So my questions are:
(0) Is the fact that initWithFrame does not set the currentControlTint a bug 
(and hence worth a bug report)?
(1) It is not in the list of Designated Initializers - should it be?
(2) Other than sub-classing NSCellInit and NSButton what other code way can I 
set the controlTint for the Button?

TIA

Peter

_______________________________________________

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

Reply via email to