我试图弄清楚如何获取所有可见窗口的框架。我尝试了以下代码,但它仅适用于应用程序本身其他窗口报告 {0,0,0,0}
NSArray *windowArray = [NSWindow windowNumbersWithOptions:NSWindowNumberListAllApplications | NSWindowNumberListAllSpaces];
for(NSNumber *number in windowArray){
NSLog(@"Window number: %@", number);
NSWindow *window = [[NSApplication sharedApplication] windowWithWindowNumber:[number intValue]];
NSLog(@"Window: %@", NSStringFromRect( [[window contentView] frame]));
}
示例代码表示赞赏。