How can I determine the index of an object in an NSMutableArray when I search for a NSString within it?
问题 Currently I am coding the search capability of a UISearchBar using data from a DB that's displayed in a table. I figure out the search results and save them to NSMutableArray *searchResults . Here's how that looks: - (void) searchGrapesTableView { [searchResult removeAllObjects]; numSearchWines=0; for (NSString *str in listOfWines) { NSRange titleResultsRange = [str rangeOfString:searchBar.text options:NSCaseInsensitiveSearch]; if (titleResultsRange.length > 0) { [searchResult addObject:str];