获取某个 UITableViewCell 的屏幕坐标?
所以,我有这个UITableView
。它位于 iPad 应用程序中。有些单元格的右侧有一个附件按钮(小圆形箭头)。当按下该按钮时,我会呈现一个弹出视图,用户可以在其中选择与他们触摸的表格单元格相关的操作。到目前为止,这一切都不是困难的或特殊的。
但是弹出视图想要知道它来自哪里,以便它可以绘制指向那里的小箭头。我自然希望该箭头指向与弹出窗口相关的表格单元格。
如果我知道表中某个单元格的索引路径,如何找出它当前的屏幕坐标?
So, I have this UITableView
. It's in an iPad application. Some of the cells have an accessory button on the right (the small round arrow). When that is pressed, I present a popover view where the user can select actions related to the table cell that they touched. So far, nothing of this is difficult or exceptional.
But the popover view wants to know where it originates from, so that it can draw the little arrow pointing there. I would naturally like that arrow to point at the table cell the popover relates to.
How can I find out the current on screen coordinates for a certain cell in a table, given that I know it's indexPath?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 UITableView 方法
-rectForRowAtIndexPath:
。请注意,这将返回表视图坐标系中的一个矩形 - 如果您需要相对于同一窗口中另一个视图的矩形,请使用 UIView 方法-convertRect:fromView:
。Use the UITableView method
-rectForRowAtIndexPath:
. Note that that returns a rect within the table view’s coordinate system—if you need the rect relative to another view within the same window, use the UIView method-convertRect:fromView:
.