如何覆盖MacRuby中的initWithContentRect?

时间:2010-10-25 07:04:45

标签: ruby cocoa macruby

我想覆盖子类NSWindow上的initWithContentRect,就像我在Obj-C中看到的那样,为了从笔尖创建一个无边框窗口。

如果我试试这个:

class GroupWindow < NSWindow
def initWithContentRect(contentRect, styleMask:windowStyle, backing:bufferingType, defer:deferCreation)
    super.initWithContentRect(
        contentRect,
        styleMask:NSBorderlessWindowMask,
        backing:bufferiMacngType,
        defer:deferCreation)
end
end

然后以EXC_BAD_ACCESS

终止

如果我试试这个:

    def initWithContentRect(contentRect, styleMask:windowStyle, backing:bufferingType, defer:deferCreation)
    super(
        contentRect,
        styleMask:NSBorderlessWindowMask,
        backing:bufferingType,
        defer:deferCreation)
end

然后只退出返回码1。

1 个答案:

答案 0 :(得分:3)

你应该这样做:

super(contentRect,NSBorderlessWindowMask,bufferingType,deferCreation)