rectArrayForGlyphRange:withinSelectedGlyphRange:inTextContainer:rectCount:
グリフの範囲でテキストコンテナのグリフの矩形の配列を返します
-(NSRectArray)rectArrayForGlyphRange:(NSRange)glyphRange: withinSelectedGlyphRange:(NSRange)selGlyphRange: inTextContainer:(NSTextContainer *)aTextContainer: rectCount:(unsigned *)rectCount:
解説
グリフの範囲でテキストコンテナのグリフの矩形の配列を返します。
返り値
( NSRectArray )
引数
( NSRange )glyphRange
グリフ範囲
( NSRange )selGlyphRange
選択グリフ範囲
( NSTextContainer * )aTextContainer
テキストコンテナ
( unsigned * )rectCount
フレームワーク
ApplicationKit
クラス
NSLayoutManager
Instance Methods
使用可能
10.0
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { //myOutletはTextView NSLayoutManager *layM1; NSRange range; NSRectArray arr; unsigned rec; NSTextContainer *textContainer1 = [[NSTextContainer allocWithZone:NULL] initWithContainerSize:NSMakeSize(1.0e6, 1.0e6)]; NSTextContainer *textContainer2 = [[NSTextContainer allocWithZone:NULL] initWithContainerSize:NSMakeSize(1.0e6, 1.0e6)]; layM1 = [myOutlet1 layoutManager]; [myOutlet1 insertText:@"this is a pen."]; [layM1 addTextContainer:textContainer1]; [layM1 insertTextContainer:textContainer2 atIndex:1]; arr = [layM1 rectArrayForGlyphRange:NSMakeRange(1,3) withinSelectedGlyphRange:NSMakeRange(2,4) inTextContainer:textContainer1 rectCount:&rec ]; //NSLog([arr className]); NSLog([NSString stringWithFormat:@"%u,%u",range.location,range.length]); NSLog([NSString stringWithFormat:@"%u",rec]); } @end