PopupMenu

open class PopupMenu : UIView, UITableViewDataSource, UITableViewDelegate

弹出菜单

YBPopupMenu

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

    Declaration

    Swift

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

    Declaration

    Swift

    open var images: [Any]
  • 圆角半径

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    open var borderColor: UIColor?
  • 箭头宽度

    Declaration

    Swift

    open var arrowWidth: CGFloat
  • 箭头高度

    Declaration

    Swift

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

    Declaration

    Swift

    open var arrowPosition: CGFloat
  • 箭头方向

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    open var maxVisibleCount: Int
  • menu背景色

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    open var orientationManager: PopupMenuDeviceOrientationManager
  • 动画管理

    Declaration

    Swift

    open var animationManager: PopupMenuAnimationManager
  • 事件代理

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    public override init(frame: CGRect)
  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    open func show()
  • 隐藏

    Declaration

    Swift

    open func dismiss()

UITableView

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

Private

  • Undocumented

    Declaration

    Swift

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

    Declaration

    Swift

    open override func draw(_ rect: CGRect)