AlertAction

@MainActor
public class AlertAction : NSObject

弹窗动作

  • action的标题

    Declaration

    Swift

    @MainActor
    public var title: String? { get set }
  • action的富文本标题

    Declaration

    Swift

    @MainActor
    public var attributedTitle: NSAttributedString? { get set }
  • action的图标,位于title的左边

    Declaration

    Swift

    @MainActor
    public var image: UIImage? { get set }
  • title跟image之间的间距

    Declaration

    Swift

    @MainActor
    public var imageTitleSpacing: CGFloat { get set }
  • 渲染颜色,当外部的图片使用了UIImageRenderingModeAlwaysTemplate时,使用该属性可改变图片的颜色

    Declaration

    Swift

    @MainActor
    public var tintColor: UIColor?
  • 是否能点击,默认为YES

    Declaration

    Swift

    @MainActor
    public var isEnabled: Bool { get set }
  • 是否是首选动作,默认为NO

    Declaration

    Swift

    @MainActor
    public var isPreferred: Bool { get set }
  • action的标题颜色,这个颜色只是普通文本的颜色,富文本颜色需要用NSForegroundColorAttributeName

    Declaration

    Swift

    @MainActor
    public var titleColor: UIColor? { get set }
  • action的标题字体,如果文字太长显示不全,会自动改变字体自适应按钮宽度,最多压缩文字为原来的0.5倍封顶

    Declaration

    Swift

    @MainActor
    public var titleFont: UIFont? { get set }
  • action的标题的内边距,如果在不改变字体的情况下想增大action的高度,可以设置该属性的top和bottom值,默认UIEdgeInsetsMake(0, 15, 0, 15)

    Declaration

    Swift

    @MainActor
    public var titleEdgeInsets: UIEdgeInsets
  • 样式

    Declaration

    Swift

    @MainActor
    public private(set) var style: AlertActionStyle { get }
  • 自定义样式,默认为样式单例

    Declaration

    Swift

    @MainActor
    public var alertAppearance: AlertControllerAppearance { get }
  • Undocumented

    Declaration

    Swift

    @MainActor
    public init(title: String?, style: AlertActionStyle, appearance: AlertControllerAppearance? = nil, handler: ((AlertAction) -> Void)?)
  • Undocumented

    Declaration

    Swift

    @MainActor
    override public init()