Get on screen coordinates of a certain UITableViewCell?

社会主义新天地 提交于 2019-12-18 13:17:28

问题


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?


回答1:


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:.



来源:https://stackoverflow.com/questions/3400029/get-on-screen-coordinates-of-a-certain-uitableviewcell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!