Я хочу знать, как закрыть NSPopover программно, не касаясь снаружи, потому что я хочу назначить его действию (например, KeyDown Enter Key или другому ярлыку)
т.к. свой NSPopover я открываю с помощью ярлыка, было бы логичнее закрыть нажатием другой команды
собираюсь поделиться своим кодом:
EdiciondeCuentasWC.h (NSWindowController), откуда я вызываю свой NSPopover
#import "EdicionDeCuentasWC.h"
#import "CambiarTipoCuentaVC.h"
@interface EdicionDeCuentasWC ()<NSPopoverDelegate>{
CambiarTipoCuentaVC *cambiarTipoCuentaVC;
}
@property (strong) IBOutlet NSPopover *popoverClasifCuentas;
@end
@implementation EdicionDeCuentasWC
-(void)mostrarPopupCambiarTipoCta{
cambiarTipoCuentaVC = (CambiarTipoCuentaVC *) _popoverCambiarTipoCuentas.contentViewController;
cambiarTipoCuentaVC.nombre_tipo_cta = arrayActivos[renglonSeleccionado][@"nombre_tipo_cta"];
cambiarTipoCuentaVC.prioridad_cta = arrayActivos[renglonSeleccionado][@"prioridad_cta"];
NSTableCellView *cellView = [_activoTableView viewAtColumn:0
row:renglonSeleccionado
makeIfNecessary:NO];
[_popoverClasifCuentas setDelegate:self];
[cambiarTipoCuentaVC inicializarDatos];
[_popoverCambiarTipoCuentas showRelativeToRect:[cellView bounds] ofView:cellView preferredEdge:NSMaxXEdge];
}
#pragma mark NSPopoverDelegate
-(void)popoverWillClose:(NSNotification *)notification{
NSPopover *popover = (NSPopover *)[notification object]; //there I have the code for managing all the returning parameters...
}
@end
И код моего NSPopover находится внутри NSViewController (CambiarTipoCuentaVC), но внутри у меня нет ни [self close], ни [self PerformClose], чтобы закрыть его с помощью кнопки или ярлыка, любая помощь, чтобы заставить его работать, я был бы признателен ...