指定されたindexからNSIndexPathを作って返します
+(NSIndexPath *)indexPathWithIndex:(unsigned int)index:
解説
指定されたindexからNSIndexPathを作って返します。
返り値
( NSIndexPath * )
インデックスパス
引数
( unsigned int )index
インデックス
フレームワーク
Foundation
クラス
NSIndexPath
Class Methods
使用可能
10.4
参照
-initWithIndex:
例文
#import "MyObject.h" // IBOutlet NSTreeController* myTreeController; @implementation MyObject - (IBAction)myAction:(id)sender { 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]; NSLog([[[myTreeController content] objectAtIndex:1] className]); } @end