textView:doubleClickedOnCell:inRect:
テキストビューのアタッチメントセルをダブルクリックしたときに呼び出されます
-(void)textView:(NSTextView *)aTextView: doubleClickedOnCell:(id <NSTextAttachmentCell>)attachmentCell: inRect:(NSRect)cellFrame:
解説
テキストビューのアタッチメントセルをダブルクリックしたときに呼び出されます。
返り値
( void )
なし
引数
( NSTextView * )aTextView
テキストビュー
( id <NSTextAttachmentCell> )attachmentCell
アタッチメントセル
( NSRect )cellFrame
セルのフレーム
フレームワーク
ApplicationKit
クラス
NSTextView
Instance Methods
使用可能
10.0
参照
例文
#import "MyObject.h" //TextViewからこのクラスにdelegateしている @implementation MyObject - (void)textView:(NSTextView *)aTextView doubleClickedOnCell:(id <NSTextAttachmentCell>)attachmentCell inRect:(NSRect)cellFrame { NSLog([NSString stringWithFormat:@"%.1f,%.1f,%.1f,%.1f",cellFrame.origin.x,cellFrame.origin.y,cellFrame.size.width,cellFrame.size.height]); } - (IBAction)myAction:(id)sender { NSRange ran; //テキストアタッチメント NSTextAttachment *theAttachment; //ファイルラッパ NSFileWrapper *theWrapper = [[[NSFileWrapper alloc] initWithPath: [[NSBundle mainBundle] pathForResource:@"image" ofType:@"tiff"]] autorelease]; //テキストアタッチメント theAttachment = [[[NSTextAttachment alloc] initWithFileWrapper:theWrapper] autorelease]; // [[myOutlet textStorage] appendAttributedString: [NSAttributedString attributedStringWithAttachment:theAttachment]]; ran = NSMakeRange(1,3); [myOutlet insertText:@"<-clich!"]; [myOutlet smartInsertBeforeStringForString:@"sss" replacingRange:ran]; } @end