/ * Phone model selection area * / #import <Foundation / Foundation.h> NS_ASSUME_NONNULL_BEGIN @interface MYSelectAreaModel: NSObject the @Property (nonatomic, strong) NSString * Country; / * State * / the @Property (nonatomic, strong) NSString * areaCode; / * code * / the @Property (nonatomic, ASSIGN) NSInteger phoneLength; / * telephone length * / the @Property (nonatomic, strong) NSString * prefix; / * country first letter of the prefix * / @end NS_ASSUME_NONNULL_END / * local Fuzzy search * / - ( void) sy_search: (NSString * ) Search { // MYSelectAreaModel model // areaArray original data array // Search search keywords @ predicate predicate fuzzy search // resultArrM fuzzy search an array NSArray * dictArray = [MYSelectAreaModel mj_keyValuesArrayWithObjectArray: Self. areaArray]; NSLog ( @ " % @ " , dictArray); IF (search.length> 0 ) { // search key is not empty an NSPredicate * the predicateA = [an NSPredicate predicateWithFormat: @ " Country the CONTAINS areaCode is the CONTAINS%% @ || || CONTAINS% @ prefix @ " ,search,search,search]; NSMutableArray *itemArray = [NSMutableArray arrayWithArray:[dictArray filteredArrayUsingPredicate:predicate]]; self.resultArrM = [MYSelectAreaModel mj_objectArrayWithKeyValuesArray:itemArray]; }else {//搜索关键词为空显示全部数据 self.resultArrM = [NSMutableArray arrayWithArray:self.areaArray]; } }