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;
相关文章推荐
- 什么是对象,为什么要面向对象,怎么才能面向对象?
- 计算机--什么是对象,为什么要面向对象,怎么才能面向对象?
- 【什么是对象,为什么要面向对象,怎么才能面向对象?】
- 什么是对象,为什么要面向对象,怎么才能面向对象?
- 垃圾回收机制中,引入计数是如何实现的,内部原理是什么,怎么维持对象引用的
- 什么是对象,为什么要面向对象,怎么才能面向对象?
- new一个类对象和使用类名创建一个对象有什么区别?该怎么解决
- oracle 中--怎么查看当前表空间在作什么操作?--查锁,死锁,当前执行时间长的Sql语句,没提交的事务,对象为哪些进程所用
- 什么是不可变对象(immutable object)?Java 中怎么创建一个不可变对象?
- oracle 中--怎么查看当前表空间在作什么操作?--查锁,死锁,当前执行时间长的Sql语句,没提交的事务,对象为哪些进程所用
- 深入java的equals方法,怎么比较两个对象的内容是否相等?对象的内容指的是什么?
- OC 类的设计时,什么情况用类方法,什么时候用对象方法啊?怎么设计才最合理
- 什么是对象,为什么要面向对象,怎么才能面向对象?
- 什么是对象,为什么要面向对象,怎么才能面向对象?
- 什么是对象,为什么要面向对象,怎么才能面向对象?
- 什么是对象,为什么要面向对象,怎么才能面向对象?
- 什么是对象,为什么要面向对象,怎么才能面向对象?
- 什么是对象,为什么要面向对象,怎么才能面向对象?
- 从微软的DBML文件中我们能学到什么(它告诉了我们什么是微软的重中之重)~二 DBContext实例中,表实体对象是怎么被加入的
- 什么是对象,为什么要面向对象,怎么才能面向对象?