macOS/iOS API解説

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

目次

setWithCapacity:

変更可能なセットを作って返します
+(id)setWithCapacity:(unsigned)numItems

解説

変更可能なセットを作って返します。

返り値

( id )

変更可能なセット

引数

( unsigned )numItems

初期設定値

クラス

NSMutableSet

Class Methods

使用可能

10.0

参照

- initWithCapacity:
+ set (NSSet)
+ setWithObjects:count:(NSSet)

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{

NSMutableSet *set = [NSMutableSet setWithCapacity:1];
NSMutableSet *set2 = [NSMutableSet setWithObjects:@"aaa",@"ccc",@"bbb",nil];
            
NSLog([[set allObjects] description]);
if ([set2 isEqualToSet:set])
{
NSLog(@"YES");
}else{
NSLog(@"NO");

}
}

@end