ios - NSCounted set ignoring a property -
this question has answer here:
i'm trying nscountedset
need ignore property, tried overriding isequal
method of object, , doing manual compare of properties except 1 want ignore doesn't work
any idea on how achieve it?
update
my class
@interface gsordermenumenucontent : gsbasemodel @property (copy, nonatomic) nsnumber *order_content_id; @property (copy, nonatomic) nsnumber *item_id; @property (copy, nonatomic) nsnumber *price; @property (copy, nonatomic) nsnumber *pricewithmodifiers; @property (copy, nonatomic) nsstring *course; @property (copy, nonatomic) nsstring *itemname; @property (nonatomic) gsmenuitem* item; @property (nonatomic) nsmutablearray *modifiers; @property (copy, nonatomic) nsnumber *isalreadyprinted; @property (copy,nonatomic) nsnumber *isdeleted; -(gsordermenumenucontent*)deepcopy; -(gsordercontent*) ordercontent; -(bool)isequal:(gsordermenumenucontent*)object; @end
usage:
nscountedset* countedset = [[nscountedset alloc] initwitharray:contents];
where contents array of class objects
adding breakpoint isequal
gets not called (however if doing [nsarray containsobject:...]
as mentioned in docs isequal:
method, must implement corresponding hash
method. 2 methods must implemented together.
two objects compare equal must return same hash
value.
Comments
Post a Comment