How do I override initWithContentRect in MacRuby?
I want to override initWithContentRect on a subclassed NSWindow, as I've seen done in Obj-C, in order to create a borderless window from a nib.
If I try this:
class GroupWindow < NSWindow
def initWithContentRect(contentRect, styleMask:windowStyle, backing:bufferingType, defer:deferCreation)
super.initWithContentRect(
contentRect,
styleMask:NSBorderlessWindowMask,
backing:bufferiMacngType,
defer:deferCreation)
end
end
Then it 开发者_Python百科terminates with EXC_BAD_ACCESS
If I try this:
def initWithContentRect(contentRect, styleMask:windowStyle, backing:bufferingType, defer:deferCreation)
super(
contentRect,
styleMask:NSBorderlessWindowMask,
backing:bufferingType,
defer:deferCreation)
end
Then it just exits with return code 1.
You should do:
super(contentRect, NSBorderlessWindowMask, bufferingType, deferCreation)
精彩评论