问题描述
每当触摸我的表格视图中的单元格时,我都会显示一个弹出框,箭头指向单元格,并且始终指向左或右,而不是向上或向下.
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.
table view被设置为popover的passthroughView
,这样用户可以在popover仍然打开的时候选择不同的cell,从而为选中的cell产生一个新的popover.
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?
不幸的是,UITableView 是,而不是包含在一个 UIScrollView 中,所以我不能简单地在 tableview 的坐标系中呈现弹出框.此外,表格单元格似乎没有定义的框架来呈现弹出窗口.我在 API 中看不到任何手动移动弹出框箭头的方法.
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.
有什么想法吗?谢谢.
推荐答案
事实证明,即使弹出框已经呈现,你也可以使用 presentPopoverFromRect:InView:
;这将导致弹出框控制器重新计算其箭头位置.
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.
这篇关于用于在滚动视图中跟踪对象的 Popover 箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!