FWToolbarTitleView
@interface FWToolbarTitleView : UIControl
可作为导航栏标题控件,通过 navigationItem.titleView 来设置。也可当成单独的标题组件,脱离 UIViewController 使用
默认情况下 titleView 是不支持点击的,如需点击,请把 userInteractionEnabled
设为 YES
-
事件代理
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<FWToolbarTitleViewDelegate> delegate;
-
标题栏样式
Declaration
Objective-C
@property (nonatomic) FWToolbarTitleViewStyle style;
-
标题栏是否是激活状态,主要针对accessoryImage生效
Declaration
Objective-C
@property (nonatomic, getter=isActive) BOOL active;
-
动画方式设置标题栏是否激活,主要针对accessoryImage生效
Declaration
Objective-C
- (void)setActive:(BOOL)active animated:(BOOL)animated;
-
标题栏最大显示宽度
Declaration
Objective-C
@property (nonatomic) CGFloat maximumWidth;
-
标题标签
Declaration
Objective-C
@property (nonatomic, strong, readonly) UILabel *_Nonnull titleLabel;
-
标题文字
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *title;
-
副标题标签
Declaration
Objective-C
@property (nonatomic, strong, readonly) UILabel *_Nonnull subtitleLabel;
-
副标题
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *subtitle;
-
是否适应tintColor变化,影响titleLabel、subtitleLabel、loadingView,默认YES
Declaration
Objective-C
@property (nonatomic) BOOL adjustsTintColor;
-
水平布局下的标题字体,默认为 加粗17
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIFont *horizontalTitleFont;
-
水平布局下的副标题的字体,默认为 加粗17
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIFont *horizontalSubtitleFont;
-
垂直布局下的标题字体,默认为 15
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIFont *verticalTitleFont;
-
垂直布局下的副标题字体,默认为 12
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIFont *verticalSubtitleFont;
-
标题的上下左右间距,标题不显示时不参与计算大小,默认为 UIEdgeInsetsZero
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets titleEdgeInsets;
-
副标题的上下左右间距,副标题不显示时不参与计算大小,默认为 UIEdgeInsetsZero
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets subtitleEdgeInsets;
-
标题栏左侧loading视图,可自定义,开启loading后才存在
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIView<FWIndicatorViewPlugin> *loadingView;
-
是否显示loading视图,开启后才会显示,默认NO
Declaration
Objective-C
@property (nonatomic) BOOL showsLoadingView;
-
是否隐藏loading,开启之后生效,默认YES
Declaration
Objective-C
@property (nonatomic) BOOL loadingViewHidden;
-
标题右侧是否显示和左侧loading一样的占位空间,默认YES
Declaration
Objective-C
@property (nonatomic) BOOL showsLoadingPlaceholder;
-
loading视图指定大小,默认(18, 18)
Declaration
Objective-C
@property (nonatomic) CGSize loadingViewSize;
-
指定loading右侧间距,默认3
Declaration
Objective-C
@property (nonatomic) CGFloat loadingViewSpacing;
-
自定义accessoryView,设置后accessoryImage无效,默认nil
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIView *accessoryView;
-
自定义accessoryImage,accessoryView为空时才生效,默认nil
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIImage *accessoryImage;
-
指定accessoryView偏移位置,默认(3, 0)
Declaration
Objective-C
@property (nonatomic) CGPoint accessoryViewOffset;
-
值为YES则title居中,
accessoryView
放在title的左边或右边;如果为NO,accessoryView
和title整体居中;默认NODeclaration
Objective-C
@property (nonatomic) BOOL showsAccessoryPlaceholder;
-
同 accessoryView,用于 subtitle 的 AccessoryView,仅Vertical样式生效
Declaration
Objective-C
@property (nonatomic, strong, nullable) UIView *subAccessoryView;
-
指定subAccessoryView偏移位置,默认(3, 0)
Declaration
Objective-C
@property (nonatomic) CGPoint subAccessoryViewOffset;
-
同 showsAccessoryPlaceholder,用于 subtitle
Declaration
Objective-C
@property (nonatomic) BOOL showsSubAccessoryPlaceholder;
-
整个titleView是否左对齐,需结合isExpandedSize使用,默认NO居中对齐
Declaration
Objective-C
@property (nonatomic) BOOL alignmentLeft;
-
是否使用扩张尺寸,开启后会自动撑开到最大尺寸,默认NO
Declaration
Objective-C
@property (nonatomic) BOOL isExpandedSize;
-
当titleView用于navigationBar且左对齐时,指定titleView离左侧的最小距离,默认为16同系统
Declaration
Objective-C
@property (nonatomic) CGFloat minimumLeftMargin;
-
指定样式初始化
Declaration
Objective-C
- (nonnull instancetype)initWithStyle:(FWToolbarTitleViewStyle)style;