macOS/iOS API解説

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

目次

initRegularFileWithContents:

データでファイルラッパを作って初期化して返します
-(id)initRegularFileWithContents:(NSData *)contents:

解説

データでファイルラッパを作って初期化して返します。

返り値

( id )

ファイルラッパ

引数

( NSData * )contents

内容のデータ

フレームワーク

ApplicationKit

クラス

NSFileWrapper

Instance Methods

使用可能

10.0

参照

- setPreferredFilename:
- filename
- fileAttributes

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
    NSData *dat = [sender dataWithEPSInsideRect:[sender frame] ];
    //ファイルラッパー
    NSFileWrapper *theWrapper = [[NSFileWrapper alloc] initRegularFileWithContents:dat];
    
    if ([theWrapper isRegularFile]){
        NSLog(@"YES");
    }else{
        NSLog(@"NO");
    }
    }

@end