iphone - Difference between containsObject: and member: methods of NSSet? -
what diference between these 2 methods belonging nsset class:
-(bool)containsobject:(id)anobject -(id)member:(id)object
the answer lies in return values. containsobject returns yes or no depending on if object send belongs particular set.
member returns id, means returns actual object if object part of set.
as example, have nsset, aset, anobject. anobject belongs set.
[aset containsobject:anobject]; //returns yes [aset member:anobject]; //if set contains object equal object (as determined isequal:) object (typically object), otherwise nil. if anobject not exist in aset:
[aset containsobject:anobject]; //return no [aset member:anobject]; //return nil
Comments
Post a Comment