查看NSWorkspace和NSWorkspaceDidLaunchApplicationNotification.像这样的东西:
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(appDidLaunch:) name:NSWorkspaceDidLaunchApplicationNotification object:nil]
Run Code Online (Sandbox Code Playgroud)
传递给指定方法的NSNotification对象将包含有关启动的应用程序,其路径等的信息.例如:
- (void)appDidLaunch:(NSNotification*)note
{
NSLog(@"app launched: %@", [note userInfo]);
}
Run Code Online (Sandbox Code Playgroud)
编辑:这只适用于桌面可可应用程序 - 我很确定这在Cocoa Touch中是不可能的.只是澄清一下.
| 归档时间: |
|
| 查看次数: |
1379 次 |
| 最近记录: |