PopupMenu

@MainActor
open class PopupMenu : UIView, UITableViewDataSource, UITableViewDelegate

弹出菜单

YBPopupMenu

  • 标题数组,支持String|NSAttributedString,需show之前调用

    Declaration

    Swift

    @MainActor
    open var titles: [Any]
  • 图片数组,支持String|UIImage,需show之前调用

    Declaration

    Swift

    @MainActor
    open var images: [Any]
  • 自定义视图,需设置高度,优先级高

    Declaration

    Swift

    @MainActor
    open weak var customView: UIView? { get set }
  • 圆角半径

    Declaration

    Swift

    @MainActor
    open var cornerRadius: CGFloat
  • 自定义圆角,当自动调整方向时corner会自动转换至镜像方向

    Declaration

    Swift

    @MainActor
    open var rectCorner: UIRectCorner
  • 是否显示阴影,默认true

    Declaration

    Swift

    @MainActor
    open var showsShadow: Bool { get set }
  • 是否显示灰色蒙层,默认true

    Declaration

    Swift

    @MainActor
    open var showsMaskView: Bool { get set }
  • 自定义灰色蒙层颜色,默认黑色、透明度0.1,可设置为透明等

    Declaration

    Swift

    @MainActor
    open var maskViewColor: UIColor? { get set }
  • 选择菜单项后消失,默认true

    Declaration

    Swift

    @MainActor
    open var dismissOnSelected: Bool
  • 点击菜单外消失,默认true

    Declaration

    Swift

    @MainActor
    open var dismissOnTouchOutside: Bool
  • 自定义字体,默认15号普通

    Declaration

    Swift

    @MainActor
    open var font: UIFont?
  • 自定义颜色,默认黑色

    Declaration

    Swift

    @MainActor
    open var textColor: UIColor?
  • 设置偏移距离

    Declaration

    Swift

    @MainActor
    open var offset: CGFloat
  • 设置边框宽度

    Declaration

    Swift

    @MainActor
    open var borderWidth: CGFloat
  • 设置边框颜色

    Declaration

    Swift

    @MainActor
    open var borderColor: UIColor?
  • 箭头宽度

    Declaration

    Swift

    @MainActor
    open var arrowWidth: CGFloat
  • 箭头高度

    Declaration

    Swift

    @MainActor
    open var arrowHeight: CGFloat
  • 箭头位置,默认居中,只有箭头优先级为left|right|none时需要设置

    Declaration

    Swift

    @MainActor
    open var arrowPosition: CGFloat
  • 箭头方向

    Declaration

    Swift

    @MainActor
    open var arrowDirection: PopupMenuArrowDirection
  • 箭头优先方向,默认top,当控件超出屏幕时会自动调整箭头位置

    Declaration

    Swift

    @MainActor
    open var priorityDirection: PopupMenuPriorityDirection
  • 可见的最大行数

    Declaration

    Swift

    @MainActor
    open var maxVisibleCount: Int
  • menu背景色

    Declaration

    Swift

    @MainActor
    open var menuBackgroundColor: UIColor?
  • item高度,默认44

    Declaration

    Swift

    @MainActor
    open var itemHeight: CGFloat
  • 距离最近的屏幕的距离,默认10

    Declaration

    Swift

    @MainActor
    open var minSpace: CGFloat
  • 是否显示分割线,默认true

    Declaration

    Swift

    @MainActor
    open var showsSeparator: Bool
  • 自定义分割线高度,默认0.5

    Declaration

    Swift

    @MainActor
    open var separatorHeight: CGFloat
  • 自定义分割线颜色

    Declaration

    Swift

    @MainActor
    open var separatorColor: UIColor?
  • 自定义分割线偏移,默认zero

    Declaration

    Swift

    @MainActor
    open var separatorInsets: UIEdgeInsets
  • 自定义imageView的位置偏移,默认zero不生效

    Declaration

    Swift

    @MainActor
    open var imageEdgeInsets: UIEdgeInsets
  • 自定义textLabel的位置偏移,默认zero不生效

    Declaration

    Swift

    @MainActor
    open var titleEdgeInsets: UIEdgeInsets
  • 点击事件回调句柄

    Declaration

    Swift

    @MainActor
    open var didSelectItemBlock: ((Int) -> Void)?
  • 自定义cell句柄,优先级低于delegate

    Declaration

    Swift

    @MainActor
    open var customCellBlock: ((PopupMenu, Int) -> UITableViewCell?)?
  • 屏幕旋转管理

    Declaration

    Swift

    @MainActor
    open var orientationManager: PopupMenuDeviceOrientationManager
  • 动画管理

    Declaration

    Swift

    @MainActor
    open var animationManager: PopupMenuAnimationManager
  • 事件代理

    Declaration

    Swift

    @MainActor
    open weak var delegate: PopupMenuDelegate?
  • 表格视图

    Declaration

    Swift

    @MainActor
    open lazy var tableView: UITableView { get set }
  • 灰色蒙层

    Declaration

    Swift

    @MainActor
    open lazy var menuMaskView: UIView { get set }
  • 自定义容器视图,需show之前调用

    Declaration

    Swift

    @MainActor
    open weak var containerView: UIView? { get set }
  • 获取容器bounds

    Declaration

    Swift

    @MainActor
    open var containerBounds: CGRect { get }
  • 自定义依赖视图,优先级高于point,需show之前调用

    Declaration

    Swift

    @MainActor
    open weak var relyView: UIView?
  • 自定义弹出位置,优先级低于relyView,需show之前调用

    Declaration

    Swift

    @MainActor
    open var point: CGPoint
  • 在指定位置弹出菜单,可指定容器视图

    Declaration

    Swift

    @discardableResult
    @MainActor
    open class func show(
        in containerView: UIView? = nil,
        at point: CGPoint,
        titles: [Any]? = nil,
        icons: [Any]? = nil,
        customView: UIView? = nil,
        menuWidth: CGFloat,
        customize: (@MainActor (PopupMenu) -> Void)? = nil
    ) -> PopupMenu
  • 依赖指定view弹出菜单,可指定容器视图

    Declaration

    Swift

    @discardableResult
    @MainActor
    open class func show(
        in containerView: UIView? = nil,
        relyOn view: UIView?,
        titles: [Any]? = nil,
        icons: [Any]? = nil,
        customView: UIView? = nil,
        menuWidth: CGFloat,
        customize: (@MainActor (PopupMenu) -> Void)? = nil
    ) -> PopupMenu
  • Undocumented

    Declaration

    Swift

    @MainActor
    override public init(frame: CGRect)
  • Undocumented

    Declaration

    Swift

    @MainActor
    public required init?(coder: NSCoder)
  • 显示

    Declaration

    Swift

    @MainActor
    open func show()
  • 隐藏

    Declaration

    Swift

    @MainActor
    open func dismiss()

UITableView

  • Undocumented

    Declaration

    Swift

    @MainActor
    open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
  • Undocumented

    Declaration

    Swift

    @MainActor
    open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

Private

  • Undocumented

    Declaration

    Swift

    @MainActor
    override open var frame: CGRect { get set }
  • Undocumented

    Declaration

    Swift

    @MainActor
    override open func draw(_ rect: CGRect)