Ios 搜索栏的NSPredicate筛选器
我正在使用Ios 搜索栏的NSPredicate筛选器,ios,swift3,xcode8,Ios,Swift3,Xcode8,我正在使用NSPredicatefilter方法过滤我的搜索栏,但它不会返回任何内容profileNameLabel是我的表格视图中包含的单元格中的标签。我希望能够搜索与profileNameLabel中显示的文本相匹配的字母或单词,但没有显示任何内容。我认为NSPredicate过滤器无法正确识别profilenamelab。我是否丢失了更多代码?我刚刚接触swift,非常感谢。谢谢 下面我粘贴了我的代码(使用swift 3、xcode8) 什么是initialProfiles?该数组中的对象
NSPredicate
filter方法过滤我的搜索栏,但它不会返回任何内容profileNameLabel
是我的表格视图中包含的单元格中的标签。我希望能够搜索与profileNameLabel
中显示的文本相匹配的字母或单词,但没有显示任何内容。我认为NSPredicate
过滤器无法正确识别profilenamelab
。我是否丢失了更多代码?我刚刚接触swift,非常感谢。谢谢
下面我粘贴了我的代码(使用swift 3、xcode8)
什么是
initialProfiles
?该数组中的对象是否具有属性profileNameLabel
?使用在源上执行的谓词,而不是UIvar intialProfiles=NSMUTABLEARRY()-该数组由从firebase检索的数据组成,该数据由profileName、Country等组成。我还在func搜索栏中调用了func filterTableView
func filterTableView(ind:Int,text:String) {
switch ind {
case selectedScope.Name.rawValue:
intialProfiles.filter(using: NSPredicate(format: "profileNameLabel contains[c] %@", text))
self.searchTableView.reloadData()