FWPopupMenu


@interface FWPopupMenu : UIView

FWPopupMenu

  • 标题数组 只读属性

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSArray *titles;
  • 图片数组 只读属性

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSArray *images;
  • tableView Default separatorStyle is UITableViewCellSeparatorStyleNone

    Declaration

    Objective-C

    @property (nonatomic, strong) UITableView *_Nonnull tableView;
  • 圆角半径 Default is 5.0

    Declaration

    Objective-C

    @property (nonatomic) CGFloat cornerRadius;
  • 自定义圆角 Default is UIRectCornerAllCorners

    当自动调整方向时corner会自动转换至镜像方向

    Declaration

    Objective-C

    @property (nonatomic) UIRectCorner rectCorner;
  • 是否显示阴影 Default is YES

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isShadowShowing) BOOL isShowShadow;
  • 是否显示灰色覆盖层 Default is YES

    Declaration

    Objective-C

    @property (nonatomic) BOOL showMaskView;
  • 选择菜单项后消失 Default is YES

    Declaration

    Objective-C

    @property (nonatomic) BOOL dismissOnSelected;
  • 点击菜单外消失 Default is YES

    Declaration

    Objective-C

    @property (nonatomic) BOOL dismissOnTouchOutside;
  • 设置字体大小 自定义cell时忽略 Default is 15

    Declaration

    Objective-C

    @property (nonatomic) CGFloat fontSize;
  • 设置字体 设置时忽略fontSize Default is nil

    Declaration

    Objective-C

    @property (nonatomic, strong) UIFont *_Nonnull font;
  • 设置字体颜色 自定义cell时忽略 Default is [UIColor blackColor]

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *_Nonnull textColor;
  • 设置偏移距离 (>= 0) Default is 0.0

    Declaration

    Objective-C

    @property (nonatomic) CGFloat offset;
  • 边框宽度 Default is 0.0

    设置边框需 > 0

    Declaration

    Objective-C

    @property (nonatomic) CGFloat borderWidth;
  • 边框颜色 Default is LightGrayColor

    borderWidth <= 0 无效

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *_Nonnull borderColor;
  • 箭头宽度 Default is 15

    Declaration

    Objective-C

    @property (nonatomic) CGFloat arrowWidth;
  • 箭头高度 Default is 10

    Declaration

    Objective-C

    @property (nonatomic) CGFloat arrowHeight;
  • 箭头位置 Default is center

    只有箭头优先级是FWPopupMenuPriorityDirectionLeft/FWPopupMenuPriorityDirectionRight/FWPopupMenuPriorityDirectionNone时需要设置

    Declaration

    Objective-C

    @property (nonatomic) CGFloat arrowPosition;
  • 箭头方向 Default is FWPopupMenuArrowDirectionTop

    Declaration

    Objective-C

    @property (nonatomic) FWPopupMenuArrowDirection arrowDirection;
  • 箭头优先方向 Default is FWPopupMenuPriorityDirectionTop

    当控件超出屏幕时会自动调整箭头位置

    Declaration

    Objective-C

    @property (nonatomic) FWPopupMenuPriorityDirection priorityDirection;
  • 可见的最大行数 Default is 5;

    Declaration

    Objective-C

    @property (nonatomic) NSInteger maxVisibleCount;
  • menu背景色 自定义cell时忽略 Default is WhiteColor

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *_Nonnull backColor;
  • item的高度 Default is 44;

    Declaration

    Objective-C

    @property (nonatomic) CGFloat itemHeight;
  • popupMenu距离最近的Screen的距离 Default is 10

    Declaration

    Objective-C

    @property (nonatomic) CGFloat minSpace;
  • 设置显示模式 自定义cell时忽略 Default is FWPopupMenuTypeDefault

    Declaration

    Objective-C

    @property (nonatomic) FWPopupMenuType type;
  • 屏幕旋转管理

    Declaration

    Objective-C

    @property (nonatomic, strong) id<FWPopupMenuDeviceOrientationManager> _Nonnull orientationManager;
  • 动画管理

    Declaration

    Objective-C

    @property (nonatomic, strong) id<FWPopupMenuAnimationManager> _Nonnull animationManager;
  • 代理

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<FWPopupMenuDelegate> delegate;
  • 在指定位置弹出

    Declaration

    Objective-C

    + (nonnull FWPopupMenu *)showAtPoint:(CGPoint)point
                                  titles:(nullable NSArray *)titles
                                   icons:(nullable NSArray *)icons
                               menuWidth:(CGFloat)itemWidth
                           otherSettings:
                               (nullable void (^)(FWPopupMenu *_Nonnull __strong))
                                   otherSetting;

    Parameters

    point

    弹出的位置

    titles

    标题数组 数组里是NSString/NSAttributedString

    icons

    图标数组 数组里是NSString/UIImage

    itemWidth

    菜单宽度

    otherSetting

    其他设置

  • 依赖指定view弹出

    Declaration

    Objective-C

    + (nonnull FWPopupMenu *)
        showRelyOnView:(nonnull UIView *)view
                titles:(nullable NSArray *)titles
                 icons:(nullable NSArray *)icons
             menuWidth:(CGFloat)itemWidth
         otherSettings:
             (nullable void (^)(FWPopupMenu *_Nonnull __strong))otherSetting;

    Parameters

    view

    依赖的视图

    titles

    标题数组 数组里是NSString/NSAttributedString

    icons

    图标数组 数组里是NSString/UIImage

    itemWidth

    菜单宽度

    otherSetting

    其他设置

  • 消失

    Declaration

    Objective-C

    - (void)dismiss;