【问题标题】:UIPopoverPresentation without arrow [duplicate]没有箭头的 UIPopoverPresentation [重复]
【发布时间】:2016-07-12 08:36:02
【问题描述】:

我想在UIPopoverPresentationController 中显示UIViewController,但我不太喜欢箭头功能。

基本上我想做的是使用它附带的UIPopoverPresentationController without the arrow

我正在使用 Swift 编码。

【问题讨论】:

  • 据我所知,你不能使用没有箭头的 UIPopoverPresentationController。唯一的方法 - 使用/创建其他类。
  • 你能告诉我在哪里/搜索什么吗?
  • 不,我不能,我喜欢那个箭头,对不起:D
  • @ShadowOf 你绝对可以做到。我已经在下面为您发布了答案。积极一点,没有什么是你做不到的。 :)
  • @ShadowOf 并不是故意的。干杯:)

标签: ios iphone swift xcode uipopovercontroller


【解决方案1】:

这是我几天前解决的问题。我所做的基本上是删除箭头并自己提供了一个源代码。当然,源已更改其 Y 位置,以使其具有没有箭头的弹出效果。试试吧,对我来说就像一个魅力。

yourPopoverPresentationController!.permittedArrowDirections = UIPopoverArrowDirection.init(rawValue: 0)
let aView = //Source View that you would provide for the source rect
yourPopoverPresentationController!.sourceView = aView
let position = CGRectMake(aView.bounds.origin.x, aView.bounds.origin.y + 125, aView.bounds.size.width, aView.bounds.size.height)
yourPopoverPresentationController!.sourceRect = position

这导致了我需要的以下效果。

【讨论】:

  • 箭头出现在我的视图顶部
猜你喜欢
  • 1970-01-01
  • 2019-06-25
  • 1970-01-01
  • 2017-12-25
  • 1970-01-01
  • 1970-01-01
  • 2016-04-29
  • 2016-03-25
  • 1970-01-01
相关资源
最近更新 更多