我正在制作一个statusbar应用程序,在单击NSPopover时显示NSStatusItem,如下所示:

我增加了通过拖动边框来调整弹出窗口大小的功能,方法是像这样对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
}
}如果桌面不在全屏上,则此仅适用于。如果我试图在全屏上调整它的大小,它就是不能工作,弹出箭头神秘地消失了。
在全屏环境中调用的时候,弹出程序似乎不会重绘。有办法解决这个问题吗?
发布于 2015-06-11 23:21:29
在WWDC。问同样的问题。你必须有一个应用程序是一个UIElement应用-意味着没有码头图标,没有主菜单。
https://stackoverflow.com/questions/29153729
复制相似问题