-1
是否有任何可行的方法來知道Mac是否在後臺或前臺?如果Mac在後臺/前臺如何掃描
在iOS系統中,我們有以下幾種方法: applicationWillEnterForeground applicationWillenterBackground
但是,有沒有辦法知道,如果一臺Mac是否活動?
是否有任何可行的方法來知道Mac是否在後臺或前臺?如果Mac在後臺/前臺如何掃描
在iOS系統中,我們有以下幾種方法: applicationWillEnterForeground applicationWillenterBackground
但是,有沒有辦法知道,如果一臺Mac是否活動?
這取決於你的應用程序佈局,但在一般使用NSApplication
delegate和實施:
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
以及其對應
- (void)applicationWillResignActive:(NSNotification *)aNotification
還有其他的通知也是如此。請參閱上面的鏈接文檔。另請注意,OS X允許真正的多任務處理,因此背景/前景通常指具有焦點或不具有焦點。
請看看,謝謝 – user3009804