我想在 UIPopoverPresentationController
中展示一个 UIViewController
,但我不太喜欢它带有的箭头功能。
基本上,我想使用一个没有带有箭头的 UIPopoverPresentationController
。
我正在使用 Swift 编程。
我想在 UIPopoverPresentationController
中展示一个 UIViewController
,但我不太喜欢它带有的箭头功能。
基本上,我想使用一个没有带有箭头的 UIPopoverPresentationController
。
我正在使用 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