문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top