ios - 如何在使用多个 UIPopoverPresentationController allowedArrowDirections 时将首选项设置为一个箭头方向?
问题描述
我正在制作一个弹出式演示视图控制器,我需要在其中使用多个箭头方向(up
和down
)。为了拥有多个permittedArrowDirections
,我在 Swift 的 UIPopoverController 上遵循了 Set Multiple Arrow Directions。我还调整了弹出框的背景颜色,使箭头与背景调光视图融为一体。
问题是,对于几乎所有情况,我都需要使用 ,UIPopoverArrowDirection.up
但对于源视图正下方没有足够空间的情况,只有UIPopoverArrowDirection.down
应该使用 。但我找不到弄清楚。代码片段是:
let presentationController = .....
presentationController.sourceView = sourceView
presentationController.sourceRect = sourceView.bounds
// changing the array order doesn't help
presentationController.permittedArrowDirections = [.up, .down]
presentationController.backgroundColor = UIColor(white: 0, alpha: 0)
self.present(controller, animated: true)
如果有人需要跟进,可以在这里找到我尝试过的演示的源代码。
解决方案
推荐阅读
- regex - 正则表达式捕获部分行
- keycloak - 如何在所需操作的 processAction 方法中获取身份验证器配置
- sas - 在这种情况下,“变量”的价值是什么?我不确定如何在 SAS 中使用 trunc
- python - TypeError:需要一个类似字节的对象,而不是 Python3 中的“str”
- mysql - Percona db 集群复制到 wsrep_cluster_address=gcomm 之外的节点
- r - 当级别数低于使用 dplyr 的给定阈值时,将数值变量转换为因子
- jenkins-pipeline - 防止同一存储库上的两个更改请求以主节点为目标在同一节点上运行
- python - socket.recv() 未在发送端触发
- tensorflow - 如何将 Keras Retinanet 模型转换为 TF 模型进行预测?
- image - 你能告诉我我的图片在 Safari 中的样子吗