How to show desktop by minimize all the windows with current application in mac
I want to show desktop on button click ,for that i have used [[NSWorkspace sharedWorkspace] hideOtherApplications]; this is working it is showing desktop also but it is not hiding the a开发者_开发百科pplication through which we are running the project.
Try this:
for (NSWindow *win in [NSApp windows]) {
[NSApp hide:win];
}
Edit
This code does not hide xcode properly but it works fine under Finder:
NSArray *apps = [NSArray arrayWithArray:[[NSWorkspace sharedWorkspace] runningApplications]];
for (NSRunningApplication *app in apps ) {
[app hide];
}
for (NSWindow *win in [NSApp windows]) {
[NSApp hide:win];
}
精彩评论