QMUINavigationTitleView
@interface QMUINavigationTitleView : UIControl
可作为navgationItem.titleView 的标题控件。
支持主副标题,且可控制主副标题的布局方式(水平或垂直);支持在左边显示loading,在右边显示accessoryView(如箭头)。
默认情况下 titleView 是不支持点击的,需要支持点击的情况下,请把 userInteractionEnabled
设为 YES
。
若要监听 titleView 的点击事件,有两种方法:
- 使用 UIControl 默认的 addTarget:action:forControlEvents: 方式。这种适用于单纯的点击,不需要涉及到状态切换等。
- 使用 QMUINavigationTitleViewDelegate 提供的接口。这种一般配合 titleView.accessoryType 来使用,这样就不用自己去做 accessoryView 的旋转、active 状态的维护等。
-
Undocumented
Declaration
Objective-C
@property(nonatomic, weak) id<QMUINavigationTitleViewDelegate> delegate
Swift
weak var delegate: QMUINavigationTitleViewDelegate! { get set }
-
Undocumented
Declaration
Objective-C
@property(nonatomic, assign) QMUINavigationTitleViewStyle style
Swift
var style: QMUINavigationTitleViewStyle { get set }
-
Undocumented
Declaration
Objective-C
@property(nonatomic, assign, getter=isActive) BOOL active
Swift
var isActive: Bool { get set }
-
Undocumented
Declaration
Objective-C
@property(nonatomic, assign) CGFloat maximumWidth
Swift
var maximumWidth: CGFloat { get set }
-
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 }
-
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 }
-
Undocumented
Declaration
Objective-C
@property(nonatomic, strong) UIView *accessoryView
Swift
var accessoryView: UIView! { get set }
-
Undocumented
Declaration
Objective-C
@property(nonatomic, assign) QMUINavigationTitleViewAccessoryType accessoryType
Swift
var accessoryType: QMUINavigationTitleViewAccessoryType { get set }
-
Undocumented
Declaration
Objective-C
@property(nonatomic, assign) CGPoint accessoryViewOffset
Swift
var accessoryViewOffset: CGPoint { get set }
-
Undocumented
Declaration
Objective-C
@property(nonatomic, assign) BOOL needsAccessoryPlaceholderSpace
Swift
var needsAccessoryPlaceholderSpace: Bool { get set }
-
Undocumented
Declaration
Objective-C
@property(nonatomic, strong) UIView *subAccessoryView
Swift
var subAccessoryView: UIView! { get set }
-
Undocumented
Declaration
Objective-C
@property(nonatomic, assign) CGPoint subAccessoryViewOffset
Swift
var subAccessoryViewOffset: CGPoint { get set }
-
Undocumented
Declaration
Objective-C
@property(nonatomic, assign) BOOL needsSubAccessoryPlaceholderSpace
Swift
var needsSubAccessoryPlaceholderSpace: Bool { get set }
-
Undocumented
Declaration
Objective-C
- (instancetype)initWithStyle:(QMUINavigationTitleViewStyle)style;
Swift
init!(style: QMUINavigationTitleViewStyle)