I have a custom cell which contains UILabel and UIImageView. Retrieving data with JSON. My UISearchBar working perfectly when searching text but my UIImageView's index is not changing.
-(void) searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
if (searchText.length == 0) {
isSearchBarClicked = FALSE;
[displayItems removeAllObjects];
[displayItems addObjectsFromArray:userNames];
[displayPictures removeAllObjects];
[displayPictures addObjectsFromArray:profilePictures];
} else {
isSearchBarClicked = true;
[displayItems removeAllObjects];
[displayPictures removeAllObjects];
for (NSString * string in userNames) {
NSRange r = [string rangeOfString:searchText options:NSCaseInsensitiveSearch];
if (r.location != NSNotFound) {
[displayItems addObject:string];
//I HAVE TO ADD OBJECT TO displayPictures FROM profilePictures IN HERE.
}
}
}
[tableView reloadData];
}
Please give me an advice.