弹出层 1.3.0

弹出层 1.3.0

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2020年1月
SPM支持SPM

corin8823维护。



弹出层 1.3.0

弹出层

CI Status Version License Platform

描述和Appetize.io的DEMO

用法

要运行示例项目,请首先克隆存储库,然后从示例目录运行 pod install

简单

let startPoint = CGPoint(x: self.view.frame.width - 60, y: 55)
let aView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 180))
let popover = Popover()
popover.show(aView, point: startPoint)

自定义

@IBOutlet weak var leftBottomButton: UIButton!

let width = self.view.frame.width / 4
let aView = UIView(frame: CGRect(x: 0, y: 0, width: width, height: width))
let options = [
  .type(.up),
  .cornerRadius(width / 2),
  .animationIn(0.3),
  .blackOverlayColor(UIColor.red),
  .arrowSize(CGSize.zero)
  ] as [PopoverOption]
let popover = Popover(options: options, showHandler: nil, dismissHandler: nil)
popover.show(aView, fromView: self.leftBottomButton)

需求

  • iOS 9.0+
  • Swift 5

安装

CocoaPods (iOS 8+)

Popover 可通过 CocoaPods 安装。要安装它,只需将以下行添加到您的 Podfile

use_frameworks!
pod "Popover"

Carthage (iOS 8+)

您可以使用 CarthagePopover 添加到您的 Cartfile 以进行安装

github "corin8823/Popover"

手动安装

所需的 Popover 类文件位于此仓库根目录下的 Classes 文件夹中,如下所示

Popover.swift

自定义

枚举

  • case arrowSize(CGSize)
  • case animationIn(NSTimeInterval)
  • case animationOut(NSTimeInterval)
  • case cornerRadius(CGFloat)
  • case sideEdge(CGFloat)
  • case blackOverlayColor(UIColor)
  • case overlayBlur(UIBlurEffectStyle)
  • case type(Popover.PopoverType)
  • case 颜色(UIColor)
  • case 隐藏 khi nhấn mờ đen (Bool)
  • case 显示黑覆盖 (Bool)

属性

  • 箭头大小: CGSize = CGSize(width: 16.0, height: 10.0)
  • 进入动画: NSTimeInterval = 0.6
  • 退出动画: NSTimeInterval = 0.3
  • 圆角半径: CGFloat = 6.0
  • 边框边缘: CGFloat = 20.0
  • 弹出类型: PopoverType = .down
  • 黑覆盖颜色: UIColor = UIColor(white: 0.0, alpha: 0.2)
  • 覆盖模糊: UIBlurEffect?
  • 弹出颜色: UIColor = UIColor.white

致谢

灵感来源于 DXPopoverxiekw2010

许可协议

Popup 可以在 MIT 许可协议下使用。有关更多信息,请参阅 LICENSE 文件。