The tag is a long
. NSSliderCells inherit their tag from NSActionCell, so have a tag separate from the NSSlider which uses the NSSliderCell, which inherits its tag from NSControl. In a custom NSSliderCell class, [self tag]
does return the tag set for the sliderCell in the XIB.
Here is the header for a custom slider cell class:
#import <AppKit/AppKit.h>
@interface EWSliderCell : NSSliderCell
@end
and here is the whole of the class itself:
#import "EWSliderCell.h"
@implementation EWSliderCell
-(NSRect)rectOfTickMarkAtIndex:(NSInteger)index {
static BOOL reportedTag;
if (!reportedTag) {
long myTag = [self tag];
NSLog(@"myTag=%ld", myTag);
reportedTag = TRUE;
}
return CGRectMake(0.0, 0.0, 0.0, 0.0); // remove the tick marks from the slider
}
@end
and this does execute and report the correct tag.
I'm not able to replicate the error message you report. However, if I (erroneously) write myTag = [EWSliderCell tag];
then I see the message "No known class method for selector 'tag'. tag
is not a class method, it's an instance method. (Is that the right word?) Can you post the code which produced the error message?