Popover's 用于在滚动视图中跟踪对象的箭头 [英] Popover's arrow to track an object in a scrollview

查看:28
本文介绍了Popover's 用于在滚动视图中跟踪对象的箭头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我的 tableview 中的一个单元格被触摸时,我都会显示一个弹出框,箭头指向该单元格,并且始终指向左或右,而不是向上或向下.

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仍然打开的时候选择不同的单元格,从而为选中的单元格生成一个新的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's 用于在滚动视图中跟踪对象的箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆