加在我的應用我改變standardWindowButtons的位置接近/ miniturize /擴大,像這樣:可可/ OSX - NSWindow standardWindowButton的行爲出現異常複製一次又一次
//Create the buttons
NSButton *minitButton = [NSWindow standardWindowButton:NSWindowMiniaturizeButton forStyleMask:window.styleMask];
NSButton *closeButton = [NSWindow standardWindowButton:NSWindowCloseButton forStyleMask:window.styleMask];
NSButton *fullScreenButton = [NSWindow standardWindowButton:NSWindowZoomButton forStyleMask:window.styleMask];
//set their location
[closeButton setFrame:CGRectMake(7+70, window.frame.size.height - 22 - 52, closeButton.frame.size.width, closeButton.frame.size.height)];
[fullScreenButton setFrame:CGRectMake(47+70, window.frame.size.height - 22 -52, fullScreenButton.frame.size.width, fullScreenButton.frame.size.height)];
[minitButton setFrame:CGRectMake(27+70, window.frame.size.height - 22 - 52, minitButton.frame.size.width, minitButton.frame.size.height)];
//add them to the window
[window.contentView addSubview:closeButton];
[window.contentView addSubview:fullScreenButton];
[window.contentView addSubview:minitButton];
現在,當使用按鈕有出現的窗口是兩個問題: 1.他們是灰色的,而不是他們的正確顏色 2.當鼠標在他們身上時,他們不顯示+或x標誌
任何人都可以告訴我我做錯了什麼。謝謝。
可悲的是'[按鈕高亮:YES]。'只有繪製窗口按鈕的「按下」狀態([參考](http://www.cocoabuilder.com /archive/cocoa/76398-standardwindowbuttons.html))。我還不知道尚未繪製「懸停」狀態的方法。 – rentzsch