我不知道为什么我的 didEndSelector 没有被调用。有任何想法吗?
- (void) showMonitorAlertIfNeeded {
if (! self.monitorAlert && [self isHideMonitorAlert]) {
self.monitorAlert = [MMAlertController monitorAlert];
[[self.monitorAlert window] setTitle: [self applicationName]];
[self.monitorAlert beginSheetModalForWindow: [NSApp keyWindow]
modalDelegate: self
didEndSelector: @selector(monitorAlertDidEnd:returnCode:contextInfo:)
contextInfo: nil];
[[self.monitorAlert window] setLevel: NSScreenSaverWindowLevel];
}
}
- (void) monitorAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) code contextInfo: (id) contextInfo {
switch (code) {
case NSAlertFirstButtonReturn:{
}
NSLog(@"FIRST BUTTON PRESSED");
break;
case NSAlertSecondButtonReturn:{ // don't show again.
NSLog(@"SECOND BUTTON PRESSED");
[[NSApp delegate]setIsHideMonitorAlert:NO];
}
break;
default:
break;
}
}