• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to save a window's position and size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to save a window's position and size


  • Subject: Re: How to save a window's position and size
  • From: Carl Hoefs via Cocoa-dev <email@hidden>
  • Date: Fri, 22 May 2020 15:13:05 -0700

The referenced documentation code (©2009) appears to be a wee bit outdated...

Try supplying your own NSString for the auto save name, as [window
representedFilename] no longer seems to return a valid
NSWindowFrameAutosaveName.

In AppDelegate.m I have this and it works:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    // Insert code here to initialize your application
    [self.window setFrameAutosaveName:@"NSWindowFrameAutosaveName"];
}

-Carl


> On May 22, 2020, at 2:22 PM, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> I am trying to follow these instructions:
>
> https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/WinPanel/Tasks/SavingWindowPosition.html
>
> However, my app doesn't have a NSWindowController.
> It just has a NSViewController and an AppDelegate.
>
> So i thought I could stick the two lines of code mentioned in the doc in one
> of the app delegate's methods.
>
> I tried to put them in applicationDidFinishLaunching, but they don't have an
> effect.
> I tried to define -awakeFromNib in the app delegate and put them there,
> but awakeFromNib never gets called.
>
> I defined -windowDidLoad in the app delegate, but that, too, never gets
> called.
> (However, other methods like windowWillClose or windowDidEndLiveResize do get
> called.)
>
> Any hints how to achieve the goal will be appreciated.
>
> Best regards, Gabriel
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to save a window's position and size
      • From: Gabriel Zachmann via Cocoa-dev <email@hidden>
    • Re: How to save a window's position and size
      • From: Gabriel Zachmann via Cocoa-dev <email@hidden>
References: 
 >How to save a window's position and size (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)

  • Prev by Date: How to save a window's position and size
  • Next by Date: Re: Performance issue on macOS 10.15 obtaining display name for ~/Desktop, ~/Documents, and ~/Downloads
  • Previous by thread: How to save a window's position and size
  • Next by thread: Re: How to save a window's position and size
  • Index(es):
    • Date
    • Thread