Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting a CGRect of a object in a subview in UITableViewCell in UITable to CGRect with respect to self.view

I want to convert a CGRect "aRect" of a object in a subview in UITableViewCell in UITableView to CGRect with respect to self.view.

The problem is that aRect is with respect to the subview in the table cell. But i want to make it so that it is with respect to self.view.

What i tried is this

rect = [self.view convertRect:aRect.frame toView:cellView];

but it doesn't work.

So how to convert it?

like image 220
David Gao Avatar asked Jun 09 '10 22:06

David Gao


1 Answers

Since convertRect:toView: actually deals with a CGRect in the receiver’s coordinate system, maybe [cellView convertRect:theFrame toView:self.view] (i.e. swapping the two views in your call) will work as you intended.

like image 131
Evadne Wu Avatar answered Oct 28 '22 22:10

Evadne Wu