FWToastView


@interface FWToastView : UIControl

吐司视图,默认背景色透明

  • 当前吐司类型,只读

    Declaration

    Objective-C

    @property (nonatomic, readonly) FWToastViewType type;
  • 内容视图,可设置背景色(默认#404040)、圆角(默认5),只读

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIView *_Nonnull contentView;
  • 自定义视图,仅Custom生效

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIView *customView;
  • 图片视图,仅Image存在

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) UIImageView *imageView;
  • 指示器视图,可自定义,仅Indicator存在

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIView<FWIndicatorViewPlugin> *indicatorView;
  • 进度条视图,可自定义,仅Progress存在

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIView<FWProgressViewPlugin> *progressView;
  • 标题标签,都存在,有内容时才显示

    Declaration

    Objective-C

    @property (nonatomic, readonly) UILabel *_Nonnull titleLabel;
  • 获取内容视图尺寸,需bounds存在时才有值

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGSize contentViewSize;
  • 内容背景色,默认#404040

    Declaration

    Objective-C

    @property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIColor *contentBackgroundColor;
  • 内容视图最小外间距,默认{10, 10, 10, 10}

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets contentMarginInsets;
  • 内容视图内间距,默认{10, 10, 10, 10}

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets contentInsets;
  • 视图和文本之间的间距,默认5.0

    Declaration

    Objective-C

    @property (nonatomic) CGFloat contentSpacing;
  • 内容圆角半径,默认5.0

    Declaration

    Objective-C

    @property (nonatomic) CGFloat contentCornerRadius;
  • 是否水平对齐,默认NO垂直对齐

    Declaration

    Objective-C

    @property (nonatomic) BOOL horizontalAlignment;
  • 如果不想要内容整体垂直居中,则可通过调整此属性来进行垂直偏移。默认为-30,即内容比中间略微偏上

    Declaration

    Objective-C

    @property (nonatomic) CGFloat verticalOffset;
  • 指示器图片,支持动画图片,自适应大小,仅Image生效

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIImage *indicatorImage;
  • 指示器颜色,默认白色,仅Indicator生效

    Declaration

    Objective-C

    @property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIColor *indicatorColor;
  • 指示器大小,默认根据类型处理

    Declaration

    Objective-C

    @property (nonatomic) CGSize indicatorSize;
  • 标题字体,默认16号

    Declaration

    Objective-C

    @property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIFont *titleFont;
  • 标题颜色,默认白色

    Declaration

    Objective-C

    @property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIColor *titleColor;
  • 带属性标题文本,为空时不显示

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSAttributedString *attributedTitle;
  • 当前指示器进度值,范围0~1,仅Progress生效

    Declaration

    Objective-C

    @property (nonatomic) CGFloat progress;
  • 手工点击取消时触发的句柄,默认nil不可点击取消

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(void) cancelBlock;
  • 初始化指定类型指示器

    Declaration

    Objective-C

    - (nonnull instancetype)initWithType:(FWToastViewType)type;
  • 显示吐司,不执行动画

    Declaration

    Objective-C

    - (void)show;
  • 显示吐司,执行淡入渐变动画

    Declaration

    Objective-C

    - (void)showAnimated:(BOOL)animated;
  • 隐藏吐司。吐司不存在时返回NO

    Declaration

    Objective-C

    - (BOOL)hide;
  • 隐藏吐司,延迟指定时间后执行。吐司不存在时返回NO

    Declaration

    Objective-C

    - (BOOL)hideAfterDelay:(NSTimeInterval)delay
                completion:(nullable void (^)(void))completion;
  • 清理延迟隐藏吐司定时器

    Declaration

    Objective-C

    - (void)invalidateTimer;