initForReadingWithData:
データを読み込んでアンアーカイバを初期化します
-(id)initForReadingWithData:(NSData *)data:
解説
データを読み込んでアンアーカイバを初期化します。
返り値
( id )
オブジェクト
引数
( NSData * )data
データ
フレームワーク
Foundation
クラス
NSUnarchiver
Instance Methods
使用可能
10.0
参照
- systemVersion
例文
- (IBAction)unarchive:(id)sender { //拡張子codeのファイルを選ぶ NSArray *fileTypes = [NSArray arrayWithObject:@"code"]; //オープンパネル設定 NSOpenPanel *openPanel = [NSOpenPanel openPanel]; //ホームディレクトリで開く [openPanel setDirectory:NSHomeDirectory()]; // if ([openPanel runModalForTypes:fileTypes]) { id aView = (NSView *)[[NSUnarchiver alloc] initForReadingWithData:[NSData dataWithContentsOfFile: [ openPanel filename ] ]]; NSLog([aView className]); NSLog([NSString stringWithFormat:@"%d",[aView systemVersion]]); }