macOS/iOS API解説

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

目次

removeObjectAtArrangedObjectIndexPath:

レシーバーの内容からindexPathでオブジェクトを取り除きます
-(void)removeObjectAtArrangedObjectIndexPath:(NSIndexPath *)indexPath:

解説

レシーバーの内容からindexPathでオブジェクトを取り除きます。

返り値

( void )

なし

引数

( NSIndexPath * )indexPath

取り除く場所を示すインデックスパス

フレームワーク

ApplicationKit

クラス

NSTreeController

Instance Methods

使用可能

10.4

参照

-removeObjectsAtArrangedObjectIndexPaths:

例文

#import "MyObject.h"
//	IBOutlet NSTreeController* myTreeController;

@implementation MyObject
-(void)awakeFromNib
{
		//挿入するオブジェクトを作る
	NSDictionary *dic1 = [NSDictionary dictionaryWithObject:@"aaaa" forKey:@"newKey"];
	NSDictionary *dic2 = [NSDictionary dictionaryWithObject:@"bbbb" forKey:@"newKey"];
	NSDictionary *dic3 = [NSDictionary dictionaryWithObject:@"cccc" forKey:@"newKey"];
	NSArray *objects = [NSArray arrayWithObjects:dic1,dic2,dic3,nil];
	
	//挿入する場所キーパスを作る
	NSIndexPath *path1 = [NSIndexPath indexPathWithIndex:0];
	NSIndexPath *path2 = [NSIndexPath indexPathWithIndex:1];
	NSIndexPath *path3 = [NSIndexPath indexPathWithIndex:2];
	NSArray *indexPaths = [NSArray arrayWithObjects:path1,path2,path3,nil];
	
	//挿入する
	[myTreeController insertObjects:objects atArrangedObjectIndexPaths:indexPaths];
}
- (IBAction)myAction:(id)sender
{
	NSIndexPath *path2 = [NSIndexPath indexPathWithIndex:1];
	[myTreeController removeObjectAtArrangedObjectIndexPath:path2];
}



@end