Reputation: 365
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?
Upvotes: 0
Views: 549
Reputation: 3607
I found the answer you can do the following
`
CGRect rectInTableView = [tableView rectForRowAtIndexPath:indexPath];
CGRect rectInSuperview = [tbldropdown convertRect:rectInTableView toView:[tbldropdown superview]];
`
Set the view frame as rectInSuperview.
Upvotes: 0
Reputation: 113310
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];
}
Upvotes: 0
Reputation: 135548
You can use UIView's convertPoint:fromView:
and convertPoint:toView
(and the corresponding convertRect:...
) to convert between coordinate systems.
Upvotes: 1