您的位置:首页 > 其它

NSSet是什么对象, 怎么用

2012-08-24 15:03 183 查看
就像NSArray用来存储NSObject对象,只不过用于对象无序集合。NSArray是有序的。 用法如下:

//NSSet
//Unordered collection of objects.
//Immutable. You cannot add or remove objects to it once //it’s created.
//Important methods:
+ setWithObjects:(id)firstObj, ...;  // nil terminated
- (int)count;
- (BOOL)containsObject:(id)anObject;
- (id)anyObject;
- (void)makeObjectsPerformSelector:(SEL)aSelector;
- (id)member:(id)anObject; // uses isEqual: and returns a matching object (if any)

//NSMutableSet
//Mutable version of NSSet.
+ (NSMutableSet *)set;
- (void)addObject:(id)anObject;
- (void)removeObject:(id)anObject;
- (void)removeAllObjects;
- (void)unionSet:(NSSet *)otherSet;
- (void)minusSet:(NSSet *)otherSet;
- (void)intersectSet:(NSSet *)otherSet;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐