views:

168

answers:

0

I'm having a problem with using UISearchBar in a UITableView application, where the list is not refreshing itself correctly and the item that is at the index "0" remains the same.

Here is some images to demonstrate what is happening:
In the first image, I have begun to search a list of names, and the two that show up beginning with 'a' is Alan and Amy. The number in the cell is reporting the cell's index value. Please ignore the scope control which has old values as names.
http://alantaylor.homeip.net/Ars/so1.jpg
To further refine this search, I then tap 'm'. The only name that begins with 'am' is Amy, and the TableView refreshes. However, it still shows Alan as being in this cell.
image is as before but so2.jpg

When I select the cell, I have NSLog give me the value of the name in the cell, and it correctly reports it as being Amy. So it seems as though the issue that I have here is that the cell is not redrawing itself.

If I were to change my search string to 'c', Alan still shows as the cell here - but again selecting it gives the output in the log that I have selected something else - in this case Colin.

I'm at work just now so I don't have access to my code until tonight, but essentially what I am doing is generating an NSPredicate to narrow down the returns from my NSFetchedResultsController, and then calling [TableView reloadData].

I think that I might be making a silly mistake, as I tried to create this app from scratch again and ran into the same error. If anyone has any ideas I would much appreciate it.