Popover's arrow to track an object in a scrollview

可紊 提交于 2019-12-01 08:16:02

问题


I show a popover whenever a cell in my tableview is touched, with the arrow pointing to the cell, and always pointing left or right, not up or down.

The table view is set as the popover's passthroughView, so that the user can select a different cell while the popover is still open, resulting in a new popover for the selected cell.

However, this means that the user can also scroll the table while the popover is open. When this happens, how can I make the popover's arrow continue to point at the selected cell?

Unfortunately, UITableView is, not is contained in, a UIScrollView, so I can't simply present the popover in the tableview's coordinate system. Also, table cells do not seem to have a defined frame to present the popover from. I don't see any way in the API to move the popover's arrow manually.

Any ideas? Thanks.


回答1:


It turns out, you can use presentPopoverFromRect:InView: even when the popover has already been presented; this will cause the popover controller to recompute its arrow position.



来源:https://stackoverflow.com/questions/3442953/popovers-arrow-to-track-an-object-in-a-scrollview

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