QMUINavigationTitleView

@interface QMUINavigationTitleView : UIControl

可作为navgationItem.titleView 的标题控件。

支持主副标题,且可控制主副标题的布局方式(水平或垂直);支持在左边显示loading,在右边显示accessoryView(如箭头)。

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

若要监听 titleView 的点击事件,有两种方法:

  1. 使用 UIControl 默认的 addTarget:action:forControlEvents: 方式。这种适用于单纯的点击,不需要涉及到状态切换等。
  2. 使用 QMUINavigationTitleViewDelegate 提供的接口。这种一般配合 titleView.accessoryType 来使用,这样就不用自己去做 accessoryView 的旋转、active 状态的维护等。

Titles

  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, strong, readonly) UILabel *titleLabel

    Swift

    var titleLabel: UILabel! { get }
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, copy) NSString *title

    Swift

    var title: String! { get set }
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, strong, readonly) UILabel *subtitleLabel

    Swift

    var subtitleLabel: UILabel! { get }
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, copy) NSString *subtitle

    Swift

    var subtitle: String! { get set }
  • 当 tintColor 发生变化时是否要自动把 titleLabel、subtitleLabel、loadingView 的颜色也更新为 tintColor 的色值,默认为 YES,如果你自己修改了 titleLabel、subtitleLabel、loadingView 的颜色,需要把这个值置为 NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL adjustsSubviewsTintColorAutomatically;

    Swift

    var adjustsSubviewsTintColorAutomatically: Bool { get set }
  • 水平布局下的标题字体,默认为 NavBarTitleFont

    Declaration

    Objective-C

    @property (nonatomic, strong) UIFont *horizontalTitleFont;

    Swift

    var horizontalTitleFont: UIFont! { get set }
  • 水平布局下的副标题的字体,默认为 NavBarTitleFont

    Declaration

    Objective-C

    @property (nonatomic, strong) UIFont *horizontalSubtitleFont;

    Swift

    var horizontalSubtitleFont: UIFont! { get set }
  • 垂直布局下的标题字体,默认为 UIFontMake(15)

    Declaration

    Objective-C

    @property (nonatomic, strong) UIFont *verticalTitleFont;

    Swift

    var verticalTitleFont: UIFont! { get set }
  • 垂直布局下的副标题字体,默认为 UIFontLightMake(12)

    Declaration

    Objective-C

    @property (nonatomic, strong) UIFont *verticalSubtitleFont;

    Swift

    var verticalSubtitleFont: UIFont! { get set }
  • 标题的上下左右间距,当标题不显示时,计算大小及布局时也不考虑这个间距,默认为 UIEdgeInsetsZero

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets titleEdgeInsets;

    Swift

    var titleEdgeInsets: UIEdgeInsets { get set }
  • 副标题的上下左右间距,当副标题不显示时,计算大小及布局时也不考虑这个间距,默认为 UIEdgeInsetsZero

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets subtitleEdgeInsets;

    Swift

    var subtitleEdgeInsets: UIEdgeInsets { get set }

Loading

  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, strong, readonly) UIActivityIndicatorView *loadingView

    Swift

    var loadingView: UIActivityIndicatorView! { get }
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) BOOL needsLoadingView

    Swift

    var needsLoadingView: Bool { get set }
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) BOOL loadingViewHidden

    Swift

    var loadingViewHidden: Bool { get set }
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) BOOL needsLoadingPlaceholderSpace

    Swift

    var needsLoadingPlaceholderSpace: Bool { get set }
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) CGSize loadingViewSize

    Swift

    var loadingViewSize: CGSize { get set }
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) CGFloat loadingViewMarginRight

    Swift

    var loadingViewMarginRight: CGFloat { get set }

Accessory