开发者

How to show desktop by minimize all the windows with current application in mac

开发者 https://www.devze.com 2023-03-22 11:35 出处:网络
I want to show desktop on button click ,for that i have used [[NSWorkspace sharedWorkspace] hideOtherApplications];

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];
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消