writeToPasteboard:
ペーストボードにURLオブジェクトを書き込みます
-(void)writeToPasteboard:(NSPasteboard *)pasteboard:
解説
ペーストボードにURLオブジェクトを書き込みます。事前にペーストボードが扱えるタイプを宣言(NSPasteBoardの-declareTypes:)しておかなければいけません。
返り値
( void )
なし
引数
( NSPasteboard * )pasteboard
ペーストボード
フレームワーク
ApplicationKit
クラス
NSURLAdditions
Class Methods
使用可能
10.0
参照
+ URLFromPasteboard:
- declareTypes:owner:(NSPasteboard)
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSURL *fileURL; NSURL *url = [NSURL URLWithString:@"http://www.oomori.com/"]; [[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObjects: NSURLPboardType, nil] owner:nil]; [url writeToPasteboard:[NSPasteboard generalPasteboard]]; fileURL=[NSURL URLFromPasteboard:[NSPasteboard generalPasteboard]]; NSLog([fileURL absoluteString]); } @end