0

アプリケーションのウィンドウが重なっているかどうかを検出する方法はありますか?

4

1 に答える 1

2

NSAppのウィンドウを使用する

//find overlaps
for (NSWindow *w in [NSApp windows]) {
   for (NSWindow *w2 in [NSApp windows]) {
      if (CGRectIntersectsRect(w.frame, w2.frame) || CGRectIntersectsRect(w2.frame, w.frame)) {
          // add the pairs w & w2 up in a NSDictionary with w as key and an array of w2s it intersects 
          // ....
      }
   }
}

//handle all the queued overlaps....
于 2012-11-11T20:27:09.323 に答える