开发者

Location of New Window after old window closed

开发者 https://www.devze.com 2022-12-25 22:24 出处:网络
I have an app that allows multiple windows.I have a strange bug where, if I repeatedly open and close windows, new windows are positioned lower and lower on the screen.I would expect this if I were ke

I have an app that allows multiple windows. I have a strange bug where, if I repeatedly open and close windows, new windows are positioned lower and lower on the screen. I would expect this if I were keeping 开发者_StackOverflowthe windows open, but it seems that the OS X window tiling mechanism is unaware of when my windows are closing.

Potentially relevant notes: I am using garbage collection. This is not a document-based app. When I close a window, the corresponding menu item is removed from the "Window" menu.

Any hints as to what I might be doing wrong would be appreciated. Thanks!


I remember running into this in my own application a while ago. As far as I could tell, this is just the way that Apple does things. I tried the same thing in other apps, and it was the same story.

Apple's documentation indicates that windows will cascade by default, but you can use the cascadeTopLeftFromPoint: method if you want to change the default behaviour.


If you want the window to retain its position when re-opened, set a value for the window's Autosave field in Interface Builder.

You can also set this programmatically using -setFrameAutosaveName:.

0

精彩评论

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

关注公众号