openTempFile:
指定したテンポラリファイルを開きます
10.6で非推奨
-(BOOL)openTempFile:(NSString *)fullPath:
解説
指定したテンポラリファイルを開きます。
このメソッドを使うことで、指定するファイルがテンポラリファイルで、使用されなくなった後削除されることをシステムに知らせます。
開くことができればYESを返します。
そうでなければNOを返します。
返り値
( BOOL )
開けたかYES/NO
引数
( NSString * )fullPath
フルパス
フレームワーク
ApplicationKit
クラス
NSWorkspace
Instance Methods
使用可能
10.0
参照
- openFile:
- openFile:fromImage:at:inView:
- openFile:withApplication:
- openFile:withApplication:andDeactivate:
例文
//開けるファイル拡張子の配列 NSArray *fileTypes = [ NSArray arrayWithObject : @"tiff" ]; //OpenPanelを作る NSOpenPanel *opPanel = [ NSOpenPanel openPanel ]; //OpenPanelの結果のボタン番号 int opRet; BOOL openResult; //OpenPanelでファイル選択 opRet = [ opPanel runModalForDirectory : NSHomeDirectory() //どこのディレクトリを出すか file : @"Pictures" //どのどのファイルを選択しておくか types : fileTypes ];//選べるファイルタイプ if ( opRet == NSOKButton ) { // OPENPanelのボタンがOKなら openResult = [[NSWorkspace sharedWorkspace] openTempFile:[ opPanel filename ] ]; }