QMUIToastContentView

@interface QMUIToastContentView : UIView

QMUIToastView默认使用的contentView。其结构是:customView->textLabel->detailTextLabel等三个view依次往下排列。其中customView可以赋值任意的UIView或者自定义的view。 注意,customView 会响应 tintColor 的变化。而 textLabel/detailTextLabel 在没设置颜色到 attributes 里的情况下,也会跟随 tintColor 变化,设置了 attributes 的颜色则优先使用 attributes 里的颜色。

@TODO: 增加多种类型的progressView的支持。

  • 设置一个UIView,可以是:菊花、图片等等,请自行保证 customView 的 size 被正确设置。

    Declaration

    Objective-C

    @property (nonatomic, strong) UIView *customView;

    Swift

    var customView: UIView! { get set }
  • 设置第一行大文字label。

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) UILabel *textLabel;

    Swift

    var textLabel: UILabel! { get }
  • 通过textLabelText设置可以应用textLabelAttributes的样式,如果通过textLabel.text设置则可能导致一些样式失效。

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *textLabelText;

    Swift

    var textLabelText: String! { get set }
  • 设置第二行小文字label。

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) UILabel *detailTextLabel;

    Swift

    var detailTextLabel: UILabel! { get }
  • 通过detailTextLabelText设置可以应用detailTextLabelAttributes的样式,如果通过detailTextLabel.text设置则可能导致一些样式失效。

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *detailTextLabelText;

    Swift

    var detailTextLabelText: String! { get set }
  • 设置上下左右的padding。

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets insets;

    Swift

    var insets: UIEdgeInsets { get set }
  • 设置最小size。

    Declaration

    Objective-C

    @property (nonatomic) CGSize minimumSize;

    Swift

    var minimumSize: CGSize { get set }
  • 设置customView的marginBottom。

    Declaration

    Objective-C

    @property (nonatomic) CGFloat customViewMarginBottom;

    Swift

    var customViewMarginBottom: CGFloat { get set }
  • 设置textLabel的marginBottom。

    Declaration

    Objective-C

    @property (nonatomic) CGFloat textLabelMarginBottom;

    Swift

    var textLabelMarginBottom: CGFloat { get set }
  • 设置detailTextLabel的marginBottom。

    Declaration

    Objective-C

    @property (nonatomic) CGFloat detailTextLabelMarginBottom;

    Swift

    var detailTextLabelMarginBottom: CGFloat { get set }
  • 设置textLabel的attributes,如果包含 NSForegroundColorAttributeName 则 textLabel 不响应 tintColor,如果不包含则 textLabel 会拿 tintColor 当成文字颜色。

    Declaration

    Objective-C

    @property (nonatomic, strong) NSDictionary<NSString *, id> *textLabelAttributes;

    Swift

    var textLabelAttributes: [String : Any]! { get set }
  • 设置 detailTextLabel 的 attributes,如果包含 NSForegroundColorAttributeName 则 detailTextLabel 不响应 tintColor,如果不包含则 detailTextLabel 会拿 tintColor 当成文字颜色。

    Declaration

    Objective-C

    @property (nonatomic, strong) NSDictionary<NSString *, id> *detailTextLabelAttributes;

    Swift

    var detailTextLabelAttributes: [String : Any]! { get set }