QMUINavigationButton
@interface QMUINavigationButton : UIButton
QMUINavigationButton 有两部分组成: 一部分是 UIBarButtonItem (QMUINavigationButton),提供比系统更便捷的类方法来快速初始化一个 UIBarButtonItem,推荐首选这种方式(原则是能用系统的尽量用系统的,不满足才用自定义的)。 另一部分就是 QMUINavigationButton,会提供一个按钮,作为 customView 给 UIBarButtonItem 使用,这种常用于自定义的返回按钮。 对于第二种按钮,会尽量保证样式、布局看起来都和系统的 UIBarButtonItem 一致,所以内部做了许多 iOS 版本兼容的微调。
-
获取当前按钮的
QMUINavigationButtonType
Declaration
Objective-C
@property (nonatomic, readonly) QMUINavigationButtonType type;
Swift
var type: QMUINavigationButtonType { get }
-
UIBarButtonItem 默认都是跟随 tintColor 的,所以这里声明是否让图片也是用 AlwaysTemplate 模式 默认为 YES
Declaration
Objective-C
@property (nonatomic) BOOL adjustsImageTintColorAutomatically;
Swift
var adjustsImageTintColorAutomatically: Bool { get set }
-
导航栏按钮的初始化函数,指定的初始化方法
Declaration
Objective-C
- (nonnull instancetype)initWithType:(QMUINavigationButtonType)type title:(nullable NSString *)title;
Swift
init(type: QMUINavigationButtonType, title: String?)
Parameters
type
按钮类型
title
按钮的title
-
导航栏按钮的初始化函数
Declaration
Objective-C
- (nonnull instancetype)initWithType:(QMUINavigationButtonType)type;
Swift
init(type: QMUINavigationButtonType)
Parameters
type
按钮类型
-
导航栏按钮的初始化函数
Declaration
Objective-C
- (nonnull instancetype)initWithImage:(nullable UIImage *)image;
Swift
init(image: UIImage?)
Parameters
image
按钮的image