用于在iOS中搜索文章的搜索栏 [英] Search bar for searching in article in iOS
本文介绍了用于在iOS中搜索文章的搜索栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我是iphone的新开发人员,希望您提供指导...
Hello there, I'm new iphone developer and I want you guidance…
我想制作一个带有法律条款和对不同法律条款的解释的应用…问题是我想要一个搜索栏,因此用户可以在文章中搜索他想要的任何单词……该怎么做?
I want to make an app with legal terms and explanation to different legal articles… The problem is that I want to have a search bar, so the user is able to search inside the article for any word that he wants…how can this be done???
谢谢
推荐答案
我告诉你是因为你是新来的,否则我会否决你的问题.
I am telling you because you are new, otherwise i will down vote your question.
我有很多字典,我正在搜索这样的记录
I have array of dictionary and i am searching record like this
-(void)searchBar:(UISearchBar*)searchBar textDidChange:(NSString*)text
{
ProductFilteredArray = [[NSMutableArray alloc] init];
for (NSMutableDictionary * cty in globleAry)
{
NSRange nameRange = [[cty objectForKey:@"Name"] rangeOfString:text options:NSCaseInsensitiveSearch];
if(nameRange.location != NSNotFound)
{
[ProductFilteredArray addObject:cty];
}
}
//copy this array in arrat of table
tableArray = [ProductFilteredArray mutableCopy];
[table reloadData];
}
这篇关于用于在iOS中搜索文章的搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文