ios - Proper use of NSPredicate to retrieve data -
as first attempt guide me , tell me doing wrong. after several tutorials i've tried create mechanism displays search results according user's input. app searching in array multiple element
objects:
@interface element : nsobject{ nsinteger id; nsstring *ename; nsinteger ecategory; nsstring *edescription; addressbook *eaddress; }
i using code below:
- (void)filtercontentforsearchtext:(nsstring*)searchtext scope:(nsstring*)scope{ nspredicate *resultpredicate = [nspredicate predicatewithformat:@"(ename contains[cd] %@)", searchtext]; searchresults = [allelements filteredarrayusingpredicate:resultpredicate]; }
my problem that, results not expecting. returns element
s ename
not match searchtext
have noticed given text appeared in edescription
!
how above can modified in order given text in ename of element
?
Comments
Post a Comment