macOS/iOS API解説

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

目次

drawInsertionPointInRect:color:turnedOn:

挿入ポイントを描くかを返します
-(void)drawInsertionPointInRect:(NSRect)aRect:
         color:(NSColor *)aColor:
         turnedOn:(BOOL)flag:

解説

挿入ポイントを描くかを返します。
flagがYESならaColorを使ってaRectで挿入位置を描きます。
flagがNOなら描きません。
このメソッドを呼び出すときにはテキストビューにフォーカスがロックされていないといけません。

返り値

( void )

なし

引数

( NSRect )aRect

範囲

( NSColor * )aColor

( BOOL )flag

フレームワーク

ApplicationKit

クラス

NSTextView

Instance Methods

使用可能

10.0

参照

- insertionPointColor
- shouldDrawInsertionPoint
- backgroundColor
- lockFocus (NSView)

例文

NSColor *theColor = [NSColor colorWithDeviceRed:1 green:0.3 blue:0.8 alpha:1];//カラー作成

if ([myOutlet shouldDrawInsertionPoint]){
[myOutlet lockFocus];
[myOutlet drawInsertionPointInRect:NSMakeRect(20,20,50,10)
                            color:theColor
                        turnedOn:YES
];
[myOutlet unlockFocus];
}else{
[myOutlet insertText:@"NO"];
}