MacPDF: Unbreak persisting the current page

I broke this when moving from a xib file to creating the UI in code.

https://developer.apple.com/documentation/appkit/nsuserinterfaceitemidentification/1396829-identifier
says:

"Identifiers are used during window restoration operations to uniquely
identify the windows of the application. [...] If you create an item in
Interface Builder and do not set a value for this string, a unique value
is created for the item when the nib file is loaded. For
programmatically created views, you typically set this value after
creating the item but before adding it to a window."

Without this, encodeRestorableStateWithCoder: / restoreStateWithCoder:
in MacPDFView weren't getting called.
This commit is contained in:
Nico Weber 2023-10-10 07:47:10 -04:00 committed by Tim Flynn
commit 409eb644c8
Notes: sideshowbarker 2024-07-17 02:08:15 +09:00

View file

@ -33,6 +33,7 @@
return nil;
_pdfView = [[MacPDFView alloc] initWithFrame:NSZeroRect];
_pdfView.identifier = @"PDFView"; // To make state restoration work.
[_pdfView setDelegate:self];
NSSplitViewController* split_view = [[NSSplitViewController alloc] initWithNibName:nil bundle:nil];