没有箭头的 UIPopoverPresentation
UIPopoverPresentation without arrow
我想在 UIPopoverPresentationController
中显示 UIViewController
,但我不太喜欢箭头功能。
基本上我想做的是使用它附带的UIPopoverPresentationController without the arrow
。
我正在 Swift 编码。
这就是我几天前解决的问题。我所做的基本上是删除箭头并自己提供一个来源。当然,来源改变了它的 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
这导致了以下效果,这正是我所需要的。
我想在 UIPopoverPresentationController
中显示 UIViewController
,但我不太喜欢箭头功能。
基本上我想做的是使用它附带的UIPopoverPresentationController without the arrow
。
我正在 Swift 编码。
这就是我几天前解决的问题。我所做的基本上是删除箭头并自己提供一个来源。当然,来源改变了它的 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
这导致了以下效果,这正是我所需要的。