- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我已经为 UIButton 实现了弹出框:
@objc func showList(sender: AnyObject?) {
guard let buttonView = sender?.value(forKey: "view") as? UIButton else { return }
guard let popVC = R.storyboard.first.VC() else { return }
popVC.modalPresentationStyle = .popover
let popOverVC = popVC.popoverPresentationController
popOverVC?.delegate = self
popOverVC?.sourceView = buttonView
popOverVC?.sourceRect = CGRect(x: 0, y: 190, width: 0, height: 0)
popOverVC?.permittedArrowDirections = .init(rawValue: 0)
popVC.preferredContentSize = CGSize(width: 150, height: 250)
showedViewController.present(popVC, animated: true, completion: nil)
}
extension VCInteractor: UIPopoverPresentationControllerDelegate {
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return .none
}
}
它运行良好,但我需要一个修复 - 我想为我的弹出窗口隐藏 UIVisualEffectBackdropView
(它就像我的 UITableViewController 下的模糊)。所以,我找不到任何关于如何禁用(隐藏)这个模糊的信息,你有什么想法吗?
最佳答案
我已经解决了自定义类的问题
class PopoverBackgroundView: UIPopoverBackgroundView {
override init(frame: CGRect) {
super.init(frame: frame)
self.layer.shadowColor = UIColor.clear.cgColor
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override static func contentViewInsets() -> UIEdgeInsets {
return UIEdgeInsets.zero
}
override static func arrowHeight() -> CGFloat {
return 0
}
override var arrowDirection: UIPopoverArrowDirection {
get { return UIPopoverArrowDirection.down }
set {
setNeedsLayout()
}
}
override var arrowOffset: CGFloat {
get { return 0 }
set {
setNeedsLayout()
}
}
}
然后我就这样添加了
popOverVC?.popoverBackgroundViewClass = PopoverBackgroundView.self
就这样
关于ios - 如何快速隐藏 UIPopoverPresentationController 的模糊?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48791090/
我是 swift 的新手,正在尝试了解如何使用 UIPopoverPresentationController。 我在我的应用程序中需要的是,当按下按钮时,屏幕按钮的弹出窗口将在屏幕的一半上显示一个
我有项目表 ( UITableViewController ),我在其中使用可自定义的单元格呈现项目。在每个单元格的左侧我有一个缩略图图像,当您单击它时(准确地说是在图像上方的按钮上),会出现一个弹出
我有一个 ViewControllerA 类,我从中提出一个 UIPopoverPresentationcontroller哪个显示来自 B 类的数据,效果很好。当我在 pop Over 中选择一个值
我正在制作一个小型 map 类型应用程序。我希望在单击“morestuff”按钮后显示弹出菜单,但它似乎没有出现。 到目前为止我有这个代码: import UIKit import MapKit im
我正在从代码初始化我的 UIPopoverPresentationController: ChoseOptionsViewController *contentController = [[Chose
我正在尝试展示一个弹出框 Controller ,但出于某种原因我无法正确设置弹出框的宽度/高度。这是我正在使用的代码: 这是我的代码: UIStoryboard* myStorybo
我有一个弹出窗口,其中 SourceRect 是设置按钮(带有齿轮图标的按钮)。弹出窗口位置对于除 LandscapeLeft 以外的所有设备方向都是正确的。 我从 XCode Interface b
我正在尝试在 iPhone 上使用 UIPopoverPresentationController 类呈现弹出窗口。我需要在弹出框内显示导航 Controller 。所以我做了以下事情: UI
我正在使用 Storyboards 和 AutoLayout。有 2 个场景,1 个是我的主视图 Controller ,带有工具栏和几个 UIBarButtonItems,1 个是应该只显示 UIL
这个问题在 Swift 4 之前已经被问过 3 次了,我想我也遇到了类似的问题。 我的 UIPopoverPresentationController 在纵向 + 横向显示为全窗口弹出窗口,添加 .N
我正在使用 UIPopoverPresentationController 实现弹出 View 。 问题在于,默认情况下, Controller 有一个半径较大的阴影。 我想禁用它 - 覆盖。 我试过
我试图将 View Controller 显示为按钮下方或窗口中心的 UIPopoverPresentationController。但它始终显示为全窗口模式弹出窗口。 UIStoryboard *s
在我的 iOS8+ 项目中,我使用 UIPopoverPresentationController 呈现一个 UIViewController: vc.modalPresentationStyle =
我正在尝试使用 UIPopoverPresentationController 来显示不占据整个屏幕的 popover。我遵循了许多不同的教程,但没有成功。 这是我的代码。它正确地实例化了 ViewC
我收到来自 Apple 的崩溃,如下所示: 正如 Xcode 所预期的那样,崩溃报告是如此糟糕,以至于我不得不猜测它来自我的代码中的哪个位置。 崩溃谈论popover。当我在显示文档文件夹中的文件的表
我创建了一个通用的 UIPopoverPresentationController。我将它放入具有 UIPopoverPresentationControllerDelegate 协议(protoco
*** 由于未捕获的异常“NSGenericException”而终止应用程序,原因:“UIPopoverPresentationController () 应在演示发生之前设置非零的 sourceV
我以编程方式创建的弹出窗口填满屏幕。从示例代码中可以看出,我尝试了很多方法来限制其大小,但都不起作用。此外,委托(delegate)方法也没有被调用。有任何想法吗?我过去曾成功地使用 CALayer
我正在使用 UIPopoverPresentationController 并像下面的代码一样分配对象, UIPopoverPresentationController *presentationCo
这个问题在这里已经有了答案: iPad detail settings page like popup viewController (1 个回答) 关闭 6 年前。 我想在 UIPopoverPr
我是一名优秀的程序员,十分优秀!