osx - Why is my window:willPositionSheet:usingRect: delegate method not called? -
I need to change an NSAlert window. I already found out that to do this, send me the ( NSRact window is required to be implemented: (NSWNDO *) Window TransmissionShot: Using NSDWNDO * sheet: React: (NSRact) Reset in method.
My code, where I trigger the warning window, is in the following method:
- (zero) webview: (webview *) sender run javascriptlittlepanel always messages: ( NSString *) Message startedBraffic: (webframe *) frame {nsalert * jsarlert = [[nsalert alloc] init]; [JsAlert addButtonWithTitle: @ "OK"]; [JsAlert setMessageText: @ ""]; [JSALert set informative text: message]; [JsAlert setAlertStyle: NSWarningAlertStyle]; // [JSLert Set Deliget: Self]; [JSLT initiatesModelForvindo: sender.wondo ModuliAditate: self-indenturer: @Selector (AlertDid: return code: referenceInfo :) referenceInfo: Nouvelle]; } I have set modalDelegate to self , where self is AppDelegate < / Code>. I have implemented the following code in AppDelegate :
- (NSRact) window: (NSWWO * *) Window KITCHESEET: (NSWWNDO *) Sheet using the database : (NSRact) rectangle {NSLog (@ "We are here:% s", __func__); Return NSMKACT (0, 0, 100, 100); // just duplicate} This method will not be called. What I have found in the documentation should work with this and I can not understand why this is not so.
I also tried the following, i.e. ephedelate to NSWindowDelegate -protocol (and the NSAlertDelegate protocol, when the first code snippet comments in the uncompressed line ).
@interface AppDelegate: NSObject & lt; NSApplicationDelegate, NSAlertDelegate, NSWindowDelegate & gt; I've read everywhere that it should work only. What am I doing wrong here?
To do the job only, actually AppDelegate to NSWindowDelegate < / Code> By this way:
- (zero) applicationDeffish: Launching: (NSNetification *) A notification {// [...] [self Windows set diallate: Self]; // [...]} It seems very trivial, but then I need a lot of time to figure it out, as I saw that all the examples did not do this . They just set modalDelegate to self which should be AppDelegate in my case.
I hope this will help someone ...
Comments
Post a Comment