You can use a NDSearchTool to complete the search easily . It take a short time to complete the function
- Use API
/**
* 默认搜索
*
* @param fieldArray 搜索字段数组
* @param inputString 输入文字
* @param array 搜索数据源
*
* @return 搜索结果
*/
- (NSArray *)searchWithFieldArray:(NSArray *)fieldArray
inputString:(NSString *)inputString
inArray:(NSArray *)array;
/**
* 分组搜索
*
* @param allFieldArray 字段数组集合
* @param inputString 输入文字
* @param allArray 搜索数组集合
*
* @return 搜索结果
*/
- (NSArray *)searchWithAllFieldArray:(NSArray *)allFieldArray
inputString:(NSString *)inputString
inAllArray:(NSArray *)allArray;
- Use Example
[[NDSearchTool tool] searchWithFieldArray:@[@"name",@"pingyin",@"code"]
inputString:searchText
inArray:self.dataSource]
[[NDSearchTool tool] searchWithAllFieldArray:@[@[@"name",@"cSpell"],@[@"name",@"cSpell"]]
inputString:searchText
inAllArray:@[self.usualListDataSource,self.traderListDataSource]]
- Time Consuming
- Demo Show
Have a question? Please open an issue!