views:

161

answers:

0

I am trying to recreate the selection behaviour as seen in the built in iPhone Voice Memo App.

That is, in the voice memo list view, when the user selects an item, and there is already another item selected, the touch down doesn't select the cell immediately, but on touch up the previously selected cell is deselected and the new cell is selected.

I can model close to this behaviour by overriding the touchesBegan and touchesEnded functions in my UITableViewCell as follows.

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{    
}


- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesBegan:touches withEvent:event];
    [super touchesEnded:touches withEvent:event];
}

On the touches began I do nothing and don't pass these events on to super. On the touches ended, I pass both touches began and touches ended to super which allows the cell to be selected on the touch up event.

However, this doesn't exactly model the behaviour as seen in the voice memo app, as what I am seeing on my table view is that on touch up, the cell that has just been touched is selected first and then, after a very small delay, the previous cell is deselected. This makes it looks like the previously selected cell deselection is always trailing behind the current selection.

Does anyone have any ideas on how to capture the behaviour as seen in the voice memo app list selection.

Thanks