views:

247

answers:

2

Hi,

When i selected a cell, i want to add the text from the cell to the underlying UIView at the same position.

So the text in the UIView should be at the same position as the text in the cell. I dont know how to map the cell origin to a UIView origin point.

Anyone any hints?

Ton.

+1  A: 

You can use UIView's convertPoint:fromView: and convertPoint:toView (and the corresponding convertRect:...) to convert between coordinate systems.

Ole Begemann
Are you sure this also works with a uiscrollview, so this can convert a point from uitable y.2300 to a y value that fits between 0 and 480 (the UIView display height) because it only works if i dont scroll downwards.
Ton
A: 

If I'm getting this right, you want to start by finding the position of the selected cell. For this, you can use the rectForRowAtIndexPath: method of UITableView:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    CGRect rect = [tableView rectForRowAtIndexPath:indexPath];
}
Can Berk Güder