Real Time Search in UITableView
I have implemented a UISearchBar for finding an element in UITableView. Everything seems to work fine, and now I am at the part where I need to actually perform real-time search for every key pressed in the textField, and narrow down the search with every button press.
So before I start coding, I wanted to kn开发者_如何学Goow if there is any inbuilt library function that could help me with live search ? (string comparison) or anything ?
Your answer could save me some time.
Thanks.
It so happens that there is in fact an inbuilt function that helps with RealTime Search. Phew !
NSRange match = [userNameString rangeOfString:searchText options:NSCaseInsensitiveSearch];
// match.location will provide the exact location of a match of searchText with a String
// match.length will provide the length of match
精彩评论