読者です 読者をやめる 読者になる 読者になる

Cocoa API解説(macOS/iOS)

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。

目次

NSDocumentクラス

INDEX>AppKit> NSDocument

**

継承 NSObject
NSObject
NSDocument
NSPersistentDocument
準拠 NSObject (NSObject)
NSFilePresenter
NSObject
NSUserInterfaceValidations
フレームワーク /System/Library/Frameworks/AppKit.framework
使用可能 OS X 10.0以降
定義
インポート文 @import AppKit;

概要

メソッドとプロパティ

Initializing

- init

Designated Initializer

- initWithContentsOfURL:ofType:error:
- initForURL:withContentsOfURL:ofType:error:
- initWithType:error:

Loading Document Data

- dataOfType:error:
- fileWrapperOfType:error:
- readFromData:ofType:error:
entireFileLoaded

Creating and Managing Window Controllers

- makeWindowControllers
windowNibName
- windowControllerDidLoadNib:
- windowControllerWillLoadNib:
windowControllers
- addWindowController:
- removeWindowController:
- shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:

Managing Document Windows

- showWindows
- setWindow:
windowForSheet
displayName

  • setDisplayName:

- defaultDraftName

Reading From and Writing to Files

- readFromFileWrapper:ofType:error:
fileModificationDate
- runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:
shouldRunSavePanelWithAccessoryView
keepBackupFile
backupFileURL
fileURL
draft

Reading From and Writing to URLs

- readFromURL:ofType:error:
- writeToURL:ofType:error:
- writeSafelyToURL:ofType:forSaveOperation:error:
- writeToURL:ofType:forSaveOperation:originalContentsURL:error:
- fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error:
- saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:
- canAsynchronouslyWriteToURL:ofType:forSaveOperation:
- changeCountTokenForSaveOperation:
- saveToURL:ofType:forSaveOperation:completionHandler:
- updateChangeCountWithToken:forSaveOperation:
- unblockUserInteraction

Serialization

- continueActivityUsingBlock:
- continueAsynchronousWorkOnMainThreadUsingBlock:
- performActivityWithSynchronousWaiting:usingBlock:
- performAsynchronousFileAccessUsingBlock:
- performSynchronousFileAccessUsingBlock:

Autosaving

- checkAutosavingSafetyAndReturnError:
- scheduleAutosaving
hasUnautosavedChanges
- autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:
- autosaveWithImplicitCancellability:completionHandler:
+ autosavesInPlace
+ autosavesDrafts
+ preservesVersions
- browseDocumentVersions:
autosavingFileType
autosavingIsImplicitlyCancellable
autosavedContentsFileURL

iCloud Document Storage

- moveDocumentToUbiquityContainer:
+ usesUbiquitousStorage

Handling Window Restoration

- encodeRestorableStateWithCoder:
- restoreStateWithCoder:
+ restorableStateKeyPaths
- invalidateRestorableState
- restoreDocumentWindowWithIdentifier:state:completionHandler:

Supporting User Activities

userActivity
- restoreUserActivityState:
- updateUserActivityState:

Managing Document Status

documentEdited
fileNameExtensionWasHiddenInLastRunSavePanel
inViewingMode

Handling User Actions

- prepareSavePanel:
- printDocument:
- runPageLayout:
- revertDocumentToSaved:
- saveDocument:
- saveDocumentAs:
- saveDocumentTo:
- saveDocumentWithDelegate:didSaveSelector:contextInfo:

Closing Documents

- canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
- close

Reverting Documents

- revertToContentsOfURL:ofType:error:

Duplicating Documents

- duplicateAndReturnError:
- duplicateDocument:
- duplicateDocumentWithDelegate:didDuplicateSelector:contextInfo:

Renaming Documents

- renameDocument:

Moving Documents

- moveDocument:
- moveDocumentWithCompletionHandler:
- moveToURL:completionHandler:

Locking Documents

- lockDocument:
- unlockDocument:
- lockDocumentWithCompletionHandler:
- lockWithCompletionHandler:
- unlockDocumentWithCompletionHandler:
- unlockWithCompletionHandler:
locked

Printing Documents

printInfo
- preparePageLayout:
- runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:
- runModalPrintOperation:delegate:didRunSelector:contextInfo:
- shouldChangePrintInfo:
- printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:
- printOperationWithSettings:error:
PDFPrintOperation
- saveDocumentToPDF:

Handling Errors

- presentError:modalForWindow:delegate:didPresentSelector:contextInfo:
- presentError:
- willPresentError:
- willNotPresentError:

Working with Undo Manager

hasUndoManager
undoManager
- updateChangeCount:

Managing File Types

fileType
fileTypeFromLastRunSavePanel
+ isNativeType:
+ readableTypes
+ canConcurrentlyReadDocumentsOfType:
+ writableTypes
- writableTypesForSaveOperation:
- fileNameExtensionForType:saveOperation:

Validating User Interface Items

- validateUserInterfaceItem:

Scripting

- handleCloseScriptCommand:
- handlePrintScriptCommand:
- handleSaveScriptCommand:
- objectSpecifier
- lastComponentOfFileName
- lastComponentOfFileName

Deprecated Methods

- canCloseDocument
Available in OS X v10.0 through OS X v10.3
- dataRepresentationOfType:
(OS X v10.4)
- fileAttributesToWriteToFile:ofType:saveOperation:
(OS X v10.4)
- fileName
(OS X v10.4)
- fileNameFromRunningSavePanelForSaveOperation:
Available in OS X v10.0 through OS X v10.3
- fileWrapperRepresentationOfType:
(OS X v10.4)
- initWithContentsOfFile:ofType:
(OS X v10.4)
- initWithContentsOfURL:ofType:
(OS X v10.4)
- loadDataRepresentation:ofType:
(OS X v10.4)
- loadFileWrapperRepresentation:ofType:
(OS X v10.4)
- printShowingPrintPanel:
(OS X v10.4)
- readFromFile:ofType:
(OS X v10.4)
- readFromURL:ofType:
(OS X v10.4)
- revertToSavedFromFile:ofType:
(OS X v10.4)
- revertToSavedFromURL:ofType:
(OS X v10.4)
- runModalPageLayoutWithPrintInfo:
(OS X v10.4)
- saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:
(OS X v10.4)
- saveToURL:ofType:forSaveOperation:error:
(OS X v10.6)
- setFileName:
(OS X v10.4)
- shouldCloseWindowController:
Available in OS X v10.0 through OS X v10.3
- validateMenuItem:
Available in OS X v10.0 through OS X v10.3
- writeToFile:ofType:
(OS X v10.4)
- writeToFile:ofType:originalFile:saveOperation:
(OS X v10.4)
- writeToURL:ofType:
(OS X v10.4)
- writeWithBackupToFile:ofType:saveOperation:
(OS X v10.4)

Data Types

NSDocumentChangeType

Constants

NSSaveOperationType
Document URL User Activity Key



定数

参照

更新時バージョン

OS X 10.11