简体   繁体   English

单击扩展坞中的应用程序图标,打开登录窗口

[英]Opening the login window on clicking on the application icon from dock

After closing the application, When i click on the application's icon on dock, i need it to open the login window. 关闭应用程序后,当我单击扩展坞上的应用程序图标时,我需要它来打开登录窗口。 I have used, 我用过,

  -(BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag
  {
  return YES;
  }

 - (BOOL)windowShouldClose:(id)sender {
   [[NSApplication sharedApplication] hide:self];
   // [NSBundle loadNibNamed:@"MainMenu" owner:self];
   return YES;
  }

But when i click on the icon at the dock, the login window is not getting loaded. 但是,当我单击扩展坞上的图标时,登录窗口未加载。 Any ideas? 有任何想法吗? Thanks. 谢谢。

To close the application when your Login Window is closed (assuming it's the only one opened in your application) you can implement applicationShouldTerminateAfterLastWindowClosed: in your application's delegate: 要在登录窗口关闭时关闭应用程序(假设它是在应用程序中唯一打开的窗口),可以在应用程序的委托中实现applicationShouldTerminateAfterLastWindowClosed: ::

- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app 
{
    return YES;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM