macOS/iOS API解説

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

目次

writeToFile:ofType:

指定したタイプでファイルを書き出します
-(BOOL)writeToFile:(NSString *)fileName:
             ofType:(NSString *)type:

解説

指定したタイプでファイルを書き出します。

返り値

( BOOL )

YES/NO

引数

( NSString * )fileName

ファイル名

( NSString * )type

タイプ

フレームワーク

ApplicationKit

クラス

NSDocument

Instance Methods

使用可能

10.0

参照

- loadDataRepresentation:ofType:
- readFromFile:ofType:
- writeToFile:ofType:originalFile:saveOperation:

例文

- (IBAction)saveDocument:(id)sender
{
if ([self writeToFile:[@"~/docSaveFile1" stringByExpandingTildeInPath]
            ofType:@"txt"
            ])
    {
    NSLog(@"YES");
    }else{
    NSLog(@"no");
    }
}