Apple Devフォーラムの開発者は、私を正しい方向に向けました:https ://devforums.apple.com/message/364824
IBからの代替画像を尊重するNSPopUpButtonCellのサブクラスとして私が思いついたものは次のとおりです。
- (void)drawImageWithFrame:(NSRect)cellRect inView:(NSView *)controlView{
NSImage *image = self.image;
if([self isHighlighted] && self.alternateImage){
image = self.alternateImage;
}
//TODO: respect -(NSCellImagePosition)imagePosition
NSRect imageRect = NSZeroRect;
imageRect.origin.y = (CGFloat)round(cellRect.size.height*0.5f-image.size.height*0.5f);
imageRect.origin.x = (CGFloat)round(cellRect.size.width*0.5f-image.size.width*0.5f);
imageRect.size = image.size;
[image drawInRect:imageRect
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1.0f
respectFlipped:YES
hints:nil];
}