Pergunta

I know that Cocoa could save a window's position in user defaults using setFrameAutosaveName: or saveFrameUsingName: method.

But where is user defaults?

Is it in the fixed place for every application?

Foi útil?

Solução

It is stored in your applications user defaults. For each window it creates a default with a fixed prefix of NSWindow Frame and appends your window's autosave name. Example:

defaults read my.app.identifier
    ...
    "NSWindow Frame MyWindowAutoSaveName" = "386 174 1811 1080 0 0 2560 1418 ";
    ...

Outras dicas

For sandboxed apps:

~/Library/Containers/my.app.identifier/Data/Library/Preferences/my.app.identifier.plist

For non-sandboxed apps:

~/Library/Preferences/my.app.identifier.plist
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top