Özel resim ve alternatif resim içeren Cocoa eğim düğmesi oluştururken garip bir davranış yaşıyorum. Basılmış durumda, düğme arka planı beyaz olur. Düğmeyi şeffaf bir pencerenin alt görünümü olarak ekliyorum (HUD penceresi). Bildiğim her tekniği çalışıyorumNSButton tıklandığında beyaz arka plan
:
NSButton *closeButton = [[NSButton alloc] initWithFrame:NSMakeRect(0.0, 0.0, 30.0, 30.0)];
[closeButton setFrameOrigin:NSMakePoint(0.0, 0.0)];
[closeButton setImagePosition:NSImageOnly];
[closeButton setAction:@selector(closeWindowAction:)];
[closeButton setBordered:NO];
[closeButton setTransparent:NO];
[closeButton setImage:[NSImage imageNamed:@"icon-tclose-off"]];
[closeButton setAlternateImage:[NSImage imageNamed:@"icon-tclose-on"]];
[closeButton setBezelStyle:NSShadowlessSquareBezelStyle];
[closeButton setButtonType:NSMomentaryLightButton];
//[[closeButton cell] setBackgroundColor:[NSColor clearColor]];
[[closeButton cell] setHighlightsBy:NSChangeBackgroundCellMask|NSCellLightsByContents];
//[[closeButton cell] setHighlightsBy:NSContentsCellMask];
//[[closeButton cell] setShowsStateBy:0|NSContentsCellMask];
Ben de hiçbir sonuçlarla
[closeButton setButtonType:NSMomentaryChangeButton];
[[closeButton cell] setHighlightsBy:NSContentsCellMask];
çalıştı.
ekteki ekran görüntüsünde yanlış davranışı görebilirsiniz:
bir HUD penceresini kaplayanKonik düğmesi:
Yanlış konik düğmesi arka planı:
Bu NSWindow myWindow olan benim için net değil. Bu düğme kabı mı? Bu durumda içeriği rect, NSRect rect olarak tanımladığınız şeydir? – loretoparisi
şimdi açık mı? –
Harika görünüyor! – loretoparisi