macOS/iOS API解説

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

目次

removeTextContainerAtIndex:

レイアウトマネージャーの指定した位置からテキストコンテナを取り除きます
-(void)removeTextContainerAtIndex:(unsigned)index:

解説

レイアウトマネージャーの指定した位置(index)からテキストコンテナを取り除きます。

返り値

( void )

なし

引数

( unsigned )index

番号

フレームワーク

ApplicationKit

クラス

NSLayoutManager

Instance Methods

使用可能

10.0

参照

- addTextContainer:
- insertTextContainer:atIndex:
- textContainers
- invalidateGlyphsForCharacterRange:changeInLength:actualCharacterRange:
- invalidateLayoutForCharacterRange:isSoft:actualCharacterRange:

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
	//myOutletはTextView
	NSLayoutManager *layM1;
	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];

	[layM1 addTextContainer:textContainer1];
	[layM1 insertTextContainer:textContainer2 atIndex:1];
	NSLog([[layM1 textContainers] description]);
	
	//remove
	[layM1 removeTextContainerAtIndex:1];
	NSLog([[layM1 textContainers] description]);
}

@end