macOS/iOS API解説

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

目次

initWithSet:

INDEX>Foundation>NSSet

セットからセットを初期化して返します
-(id)initWithSet:(NSSet *)otherSet

解説

セットからセットを初期化して返します。

返り値

( id )

セット

引数

( NSSet * )otherSet

他のセット

クラス

NSSet

Instance Methods

使用可能

10.0
iOS2.0

参照

- initWithArray:
- initWithObjects:
- initWithObjects:count:
- initWithSet:copyItems:
+ setWithSet:

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSArray *arr = [NSArray arrayWithObjects:@"aaa",@"bbb",@"ccc",nil];
NSSet *set = [NSSet setWithArray:arr];
NSSet *set2 = [[NSSet alloc] initWithSet:set];         
NSLog([[set2 allObjects] description]);

}

@end