writeToURL:ofType:
指定したURLと文書タイプでファイルに書き出します
-(BOOL)writeToURL:(NSURL *)anURL: ofType:(NSString *)type:
解説
指定したURLと文書タイプでファイルに書き出します。
ファイルのURLのみサポートします
返り値
( BOOL )
YES/NO
引数
( NSURL * )anURL
URL
( NSString * )type
文書タイプ
フレームワーク
ApplicationKit
クラス
NSDocument
Instance Methods
使用可能
10.0
参照
例文
- (IBAction)saveDocument:(id)sender { NSURL *url = [NSURL fileURLWithPath:[@"~/docSaveFile1" stringByExpandingTildeInPath]]; if ([url isFileURL]){ if ([self writeToURL:url ofType:@"txt" ]) { NSLog(@"YES"); }else{ NSLog(@"no"); } } }