macOS/iOS API解説

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

目次

lineFragmentUsedRectForGlyphAtIndex:effectiveRange:

指定したグリフを含む行分割の矩形と範囲を返します
-(NSRect)lineFragmentUsedRectForGlyphAtIndex:(unsigned)glyphIndex:
           effectiveRange:(NSRangePointer)lineFragmentRange:

解説

指定したグリフを含む行分割の矩形と範囲を返します。

返り値

( NSRect )

矩形

引数

( unsigned )glyphIndex

グリフ番号

( NSRangePointer )lineFragmentRange

行分割範囲

フレームワーク

ApplicationKit

クラス

NSLayoutManager

Instance Methods

使用可能

10.0

参照

- lineFragmentUsedRectForGlyphAtIndex:effectiveRange:
- setLineFragmentRect:forGlyphRange:usedRect:

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
//myOutletはTextView

NSLayoutManager *layM;
NSRect rect;
NSRange rPointer;
layM = [myOutlet layoutManager];
[myOutlet insertText:@"aaaaaaaaaa\n"];

rect = [layM lineFragmentUsedRectForGlyphAtIndex:3 effectiveRange:&rPointer];

NSLog([NSString stringWithFormat:@"%.1f,%.1f",rect.size.width,rect.size.height]);
NSLog([NSString stringWithFormat:@"%u,%u",rPointer.location,rPointer.length]);
}

@end