jjzjj

convertRect

全部标签

ios - 如何获得 subview 在我的 UITableViewCell 中相对于整个窗口的位置?

我知道convertRect:toRect是这里的关键,但我不确定如何调用它。我有我的单元格的subview,我想要它在应用程序的整个窗口中的位置。当我在其目标操作方法中点击此按钮(subview)时,我需要知道这一点。我想我需要调用单元格上的convertRect:toRect函数,以便获得正确的坐标,但在这个方法中我没有引用单元格本身。我是否攀登父View层次结构?这看起来很恶心,因为我不完全确定我会得到什么,因为它嵌入在单元格的contentView中,Apple用他们的私有(private)subview和诸如此类的东西做了一些古怪的事情。代码:@IBActionbuttonP

ios - 了解 convertRect :toView:, convertRect :FromView:, convertPoint:toView: 和 convertPoint:fromView: 方法

我正在尝试了解这些方法的功能。你能给我提供一个简单的用例来理解它们的语义吗?以文档为例,convertPoint:fromView:方法描述如下:Convertsapointfromthecoordinatesystemofagivenviewtothatofthereceiver.坐标系是什么意思?接收者呢?例如,像下面这样使用convertPoint:fromView:是否有意义?CGPointp=[view1convertPoint:view1.centerfromView:view1];使用NSLog实用程序,我已验证p值与view1的中心一致。提前谢谢你。编辑:对于那些感兴趣

ios - 了解 convertRect :toView:, convertRect :FromView:, convertPoint:toView: 和 convertPoint:fromView: 方法

我正在尝试了解这些方法的功能。你能给我提供一个简单的用例来理解它们的语义吗?以文档为例,convertPoint:fromView:方法描述如下:Convertsapointfromthecoordinatesystemofagivenviewtothatofthereceiver.坐标系是什么意思?接收者呢?例如,像下面这样使用convertPoint:fromView:是否有意义?CGPointp=[view1convertPoint:view1.centerfromView:view1];使用NSLog实用程序,我已验证p值与view1的中心一致。提前谢谢你。编辑:对于那些感兴趣

android - UIView 的 convertRect/convertPoint 函数的 android 等价物是什么?

UIView具有以下内容:-convertPoint:toView:-convertPoint:fromView:-convertRect:toView:-convertRect:fromView:Android的等价物是什么?更一般地说,给定两个View,如何在第一个View的坐标系中获取第二个View的矩形? 最佳答案 我认为sdk中没有等效项,但您似乎可以使用getLocationOnScreen轻松编写自己的实现:publicstaticPointconvertPoint(PointfromPoint,ViewfromVie

iphone - convertRect 获取父 View 中的相对位置

我有一堆水平的UITableView放在UIViewController1中。我想找到被点击的UITableViewCell的位置,我想根据UIViewController1获得位置。所以这是我在didSelectRowAtIndexPath中所做的:MyCell*cell=(MyCell*)[tableViewcellForRowAtIndexPath:indexPath];UIView*animatedView=[[UIViewalloc]initWithFrame:cell.frame];[animatedViewsetFrame:[animatedViewconvertRect

iOS: convertRect:toView: 没有像我预期的那样工作

我想要相对于主窗口的坐标,因此我使用convertRect:toView:并将nil作为第二个参数:CGRectresult=[self.viewconvertRect:addToList.frametoView:nil];但结果,我总是得到NSRect:{{5,30},{35,35}}这正是我用于生成addToListView的值:addToList=[UIButtonbuttonWithType:UIButtonTypeCustom];addToList.frame=CGRectMake(5.0f,30.0f,35.0f,35.0f);如果我将addToList-button添加到