将UITableViewCell中的子视图中的对象的CGRect转换为UITable中的对于self.view的CGRect [英] Converting a CGRect of a object in a subview in UITableViewCell in UITable to CGRect with respect to self.view
问题描述
我想将UITableViewCell中的子视图中的对象的CGRectaRect转换为UITable中相对于self.view的CGRect。
问题是, aRect是相对于表格单元格中的子视图。
但是我想让它与self.view相关
我试过的是这个
rect = [self.view convertRect:aRect.frame toView:cellView];
由于 convertRect:toView:
实际上处理接收者坐标中的 CGRect
系统,也许 [cellView convertRect:theFrame toView:self.view]
(即调换两个视图在你的通话)将按照你的意图。 >
I want to converte a CGRect "aRect" of a object in a subview in UITableViewCell in UITable 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?
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.
这篇关于将UITableViewCell中的子视图中的对象的CGRect转换为UITable中的对于self.view的CGRect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!