Question

I'm using a NIB with IB that's unpacked into an NSWindow by my NSWindowController subclass when it's initialized (as normal). [NSWindowController* window] gives me the window of the controller.

Now, I want to make my window controller's window be of a different class that subclasses it. Specifically, I want to override one method in it, sendEvent. This doesn't work, not that I thought it would:

self.window = ((WebViewEventKillingWindow*) self.window);

WebViewEventKillingWindow is a subclass to disable user interaction (thanks to Bob, found here Disable a WebKit WebView). I'm doubting that this is even possible to do without a different approach, but I'm fairly new to this.

Était-ce utile?

La solution

Select your window in Interface Builder, and ensure that the attributes inspector is open.

The first option in that panel is "Custom Class" - type in the name of your NSWindow sublass in there:

enter image description here

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top