macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

addFileWrapper:

レシーバがディレクトリラッパーの場合、ラッパーを追加します
-(NSString *)addFileWrapper:(NSFileWrapper *)wrapper:

解説

レシーバがディレクトリラッパーの場合、ラッパーを追加します。
追加したラッパーの優先名を返します。
ラッパーに優先名がないとNSInternalInconsistencyExceptionが起こります。

返り値

( NSString * )

辞書キー

引数

( NSFileWrapper * )wrapper

ファイルラッパー

フレームワーク

ApplicationKit

クラス

NSFileWrapper

Instance Methods

使用可能

10.0

参照

- addFileWithPath:
- addRegularFileWithContents:preferredFilename:
- addSymbolicLinkWithDestination:preferredFilename:
- removeFileWrapper:
- fileWrappers

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSData *dat = [sender dataWithEPSInsideRect:[sender frame] ];
    //ファイルラッパー

    NSFileWrapper *theWrapper = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:nil];
    
    NSFileWrapper *theWrapper2 = [[NSFileWrapper alloc] initRegularFileWithContents:dat];

    [theWrapper setPreferredFilename:@"name1"];
    [theWrapper2 setPreferredFilename:@"name2"];
    NSLog([theWrapper addFileWrapper:theWrapper2]);
NSLog([[theWrapper fileWrappers] description]);
    }

@end