ToolbarTitleView

@MainActor
open class ToolbarTitleView : UIControl, TitleViewProtocol

可作为导航栏标题控件,使用非等比例缩放布局,通过 navigationItem.titleView 来设置。也可当成单独的标题组件,脱离 UIViewController 使用

默认情况下 titleView 是不支持点击的,如需点击,请把 userInteractionEnabled 设为 YES QMUI_iOS

  • 事件代理

    Declaration

    Swift

    @MainActor
    open weak var delegate: ToolbarTitleViewDelegate?
  • 标题栏样式

    Declaration

    Swift

    @MainActor
    open var style: ToolbarTitleViewStyle { get set }
  • 标题栏是否是激活状态,主要针对accessoryImage生效

    Declaration

    Swift

    @MainActor
    open var isActive: Bool { get set }
  • 标题栏最大显示宽度,默认不限制

    Declaration

    Swift

    @MainActor
    open var maximumWidth: CGFloat { get set }
  • 标题文字

    Declaration

    Swift

    @MainActor
    open var title: String? { get set }
  • 副标题

    Declaration

    Swift

    @MainActor
    open var subtitle: String? { get set }
  • 是否适应tintColor变化,影响titleLabel、subtitleLabel、loadingView,默认YES

    Declaration

    Swift

    @MainActor
    open var adjustsTintColor: Bool
  • 水平布局下的标题字体,默认为 加粗17

    Declaration

    Swift

    @MainActor
    open var horizontalTitleFont: UIFont? { get set }
  • 水平布局下的副标题的字体,默认为 加粗17

    Declaration

    Swift

    @MainActor
    open var horizontalSubtitleFont: UIFont? { get set }
  • 垂直布局下的标题字体,默认为 15

    Declaration

    Swift

    @MainActor
    open var verticalTitleFont: UIFont? { get set }
  • 垂直布局下的副标题字体,默认为 12

    Declaration

    Swift

    @MainActor
    open var verticalSubtitleFont: UIFont? { get set }
  • 标题的上下左右间距,标题不显示时不参与计算大小,默认为 UIEdgeInsets.zero

    Declaration

    Swift

    @MainActor
    open var titleEdgeInsets: UIEdgeInsets { get set }
  • 副标题的上下左右间距,副标题不显示时不参与计算大小,默认为 UIEdgeInsets.zero

    Declaration

    Swift

    @MainActor
    open var subtitleEdgeInsets: UIEdgeInsets { get set }
  • 标题栏左侧loading视图,可自定义,开启loading后才存在

    Declaration

    Swift

    @MainActor
    open var loadingView: (UIView & IndicatorViewPlugin)? { get set }
  • 是否显示loading视图,开启后才会显示,默认NO

    Declaration

    Swift

    @MainActor
    open var showsLoadingView: Bool { get set }
  • 是否隐藏loading,开启之后生效,默认YES

    Declaration

    Swift

    @MainActor
    open var loadingViewHidden: Bool { get set }
  • 标题右侧是否显示和左侧loading一样的占位空间,默认YES

    Declaration

    Swift

    @MainActor
    open var showsLoadingPlaceholder: Bool { get set }
  • loading视图指定大小,默认(18, 18)

    Declaration

    Swift

    @MainActor
    open var loadingViewSize: CGSize
  • 指定loading右侧间距,默认3

    Declaration

    Swift

    @MainActor
    open var loadingViewSpacing: CGFloat { get set }
  • 自定义accessoryView,设置后accessoryImage无效,默认nil

    Declaration

    Swift

    @MainActor
    open var accessoryView: UIView? { get set }
  • 自定义accessoryImage,accessoryView为空时才生效,默认nil

    Declaration

    Swift

    @MainActor
    open var accessoryImage: UIImage? { get set }
  • 指定accessoryView偏移位置,默认(3, 0)

    Declaration

    Swift

    @MainActor
    open var accessoryViewOffset: CGPoint { get set }
  • 值为YES则title居中,accessoryView放在title的左边或右边;如果为NO,accessoryView和title整体居中;默认NO

    Declaration

    Swift

    @MainActor
    open var showsAccessoryPlaceholder: Bool { get set }
  • 同 accessoryView,用于 subtitle 的 AccessoryView,仅Vertical样式生效

    Declaration

    Swift

    @MainActor
    open var subAccessoryView: UIView? { get set }
  • 指定subAccessoryView偏移位置,默认(3, 0)

    Declaration

    Swift

    @MainActor
    open var subAccessoryViewOffset: CGPoint { get set }
  • 同 showsAccessoryPlaceholder,用于 subtitle

    Declaration

    Swift

    @MainActor
    open var showsSubAccessoryPlaceholder: Bool { get set }
  • 整个titleView是否左对齐,需结合isExpandedSize使用,默认NO居中对齐

    Declaration

    Swift

    @MainActor
    open var alignmentLeft: Bool { get set }
  • 是否使用扩张尺寸,开启后会自动撑开到最大尺寸,默认NO

    Declaration

    Swift

    @MainActor
    open var isExpandedSize: Bool { get set }
  • 当titleView用于navigationBar且左对齐时,指定titleView离左侧的最小距离,默认为16同系统

    Declaration

    Swift

    @MainActor
    open var minimumLeftMargin: CGFloat { get set }
  • 标题标签

    Declaration

    Swift

    @MainActor
    open lazy var titleLabel: UILabel { get set }
  • 副标题标签

    Declaration

    Swift

    @MainActor
    open lazy var subtitleLabel: UILabel { get set }
  • 指定样式初始化

    Declaration

    Swift

    @MainActor
    public init(style: ToolbarTitleViewStyle)
  • Undocumented

    Declaration

    Swift

    @MainActor
    override public init(frame: CGRect)
  • Undocumented

    Declaration

    Swift

    @MainActor
    public required init?(coder: NSCoder)
  • Undocumented

    Declaration

    Swift

    @MainActor
    override open var contentHorizontalAlignment: UIControl.ContentHorizontalAlignment { get set }
  • Undocumented

    Declaration

    Swift

    @MainActor
    override open var isHighlighted: Bool { get set }
  • Undocumented

    Declaration

    Swift

    @MainActor
    override open func setNeedsLayout()
  • Undocumented

    Declaration

    Swift

    @MainActor
    override open func sizeThatFits(_ size: CGSize) -> CGSize
  • Undocumented

    Declaration

    Swift

    @MainActor
    override open var intrinsicContentSize: CGSize { get }
  • Undocumented

    Declaration

    Swift

    @MainActor
    override open func tintColorDidChange()
  • Undocumented

    Declaration

    Swift

    @MainActor
    override open func layoutSubviews()
  • 动画方式设置标题栏是否激活,主要针对accessoryImage生效

    Declaration

    Swift

    @MainActor
    open func setActive(_ active: Bool, animated: Bool)