Search code examples
iosuitableviewdidselectrowatindexpath

How can I get the coordinates in didSelectRowAtIndexPath


I have a UITableView where selecting a row trigger an MPMoviePlayerController with a video. I'm setting the size to 0, so it's invisible.

Now I'd like to make the hiding animation nicer, by having it converge on the cell that was selected.

I can't seem to find a way to get the coordinates of the selected row without doing some ridiculous thing such as making a transparent UIView on top of the UITableView.


Solution

  • - (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath
    
    - (NSIndexPath *)indexPathForSelectedRow
    
    CGRect yourRect = [tableView rectForRowAtIndexPath: [tableView indexPathForSelectedRow]];