[英]NSStatusItem fullscreen issues
我正在創建一個狀態欄應用程序,在單擊NSStatusItem時顯示NSPopover,如下所示:
我已經添加了通過拖動邊緣來調整popover大小的功能,通過子類化popover的視圖,如下所示:
class CMView: NSView {
let tolerance : CGFloat = 10
var state = false
override func mouseDown(theEvent: NSEvent) {
let point = self.convertPoint(theEvent.locationInWindow, fromView: nil)
if (point.y <= tolerance) {
state = true
}
}
override func mouseDragged(theEvent: NSEvent) {
if (state) {
let point = self.convertPoint(theEvent.locationInWindow, fromView: nil)
self.frame = NSRect(
x: self.frame.origin.x,
y: self.frame.origin.y,
width: self.frame.size.width,
height: self.frame.size.height-point.y)
popover.contentSize = self.frame.size
}
}
override func mouseUp(theEvent: NSEvent) {
state = false
}
}
這僅適用於桌面未全屏的情況。 如果我嘗試在全屏中調整大小,它根本不起作用,並且彈出箭頭神秘地消失。
在全屏環境中調用時,似乎彈出窗口不會重繪。 有沒有解決這個問題的方法?
在WWDC。 問同樣的問題。 你必須擁有一個UIElement應用程序 - 這意味着沒有停靠圖標,沒有主菜單。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.