Peculiar behavior with Asset Type table


#1

I’m having some very odd behavior in the tableview showing the Asset Types.
Xcode 4.5.2 targeting iOS6 - behavior the same in the simulator and on hardware.

When I touch one of the entries in the Asset Type table it turns blue (i.e. selected) and just sits there. The
tableView:didDeselectRowAtIndexPath:
method does NOT get called at that point. Touching the entry again doesn’t change anything. If I then touch a different table entry, that second entry turns blue, the
tableView:didDeselectRowAtIndexPath:
method gets called with [indexPath row] set to the row of the entry that I selected first, and the view controller gets popped.
So I get the result I want, but I have to touch a different entry in the table to complete the action.

I am checking my code line-by-line, but I can’t even begin to imagine what might cause this.
Anybody have a clue?


#2

Solved:
I chose the wrong method with autocompletion. I wanted:

but what I chose was:

It does look pretty similar.
So the moral of the story goes: if selecting the first time doesn’t work but a second selection does do something – you are probably doing DidDeselect instead of DidSelect.
The larger moral is that when stuff isn’t working – look carefully at the methods you got with autocompletion.


#3

Wanted to thank you for a) posting this and b) coming back after you had solved it for yourself. I came across this strange behavior when doing chapter 16. I knew there was a problem in the selection handler method, but didn’t know it was the method that I had selected that was the error. You saved my some frustration. Thanks again.


#4

I also want to thank you! Saved me some time and gave me a lesson.