开发者

Get on screen coordinates of a certain UITableViewCell?

开发者 https://www.devze.com 2023-01-10 06:14 出处:网络
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 use

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开发者_Go百科 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消