Skip to content

Commit 78a1e67

Browse files
committed
Merge commit '00dd64d2225c501ba8cab2cc4634a75d6f28ef2c'
2 parents 1d9eb80 + 00dd64d commit 78a1e67

8 files changed

Lines changed: 111 additions & 89 deletions

File tree

QMUI/QMUIKit/UICommon/QMUIConfiguration.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@
102102
#define NavBarShadowImage [QMUICMI navBarShadowImage]
103103
#define NavBarBarTintColor [QMUICMI navBarBarTintColor]
104104
#define NavBarTintColor [QMUICMI navBarTintColor]
105-
#define NavBarTintColorHighlighted [QMUICMI navBarTintColorHighlighted]
106-
#define NavBarTintColorDisabled [QMUICMI navBarTintColorDisabled]
107105
#define NavBarTitleColor [QMUICMI navBarTitleColor]
108106
#define NavBarTitleFont [QMUICMI navBarTitleFont]
109107
#define NavBarBarBackButtonTitlePositionAdjustment [QMUICMI navBarBackButtonTitlePositionAdjustment]

QMUI/QMUIKit/UICommon/QMUIConfigurationManager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@
9898
@property(nonatomic, strong) UIColor *navBarShadowImageColor;
9999
@property(nonatomic, strong) UIColor *navBarBarTintColor;
100100
@property(nonatomic, strong) UIColor *navBarTintColor;
101-
@property(nonatomic, strong) UIColor *navBarTintColorHighlighted;
102-
@property(nonatomic, strong) UIColor *navBarTintColorDisabled;
103101
@property(nonatomic, strong) UIColor *navBarTitleColor;
104102
@property(nonatomic, strong) UIFont *navBarTitleFont;
105103
@property(nonatomic, assign) UIOffset navBarBackButtonTitlePositionAdjustment;

QMUI/QMUIKit/UICommon/QMUIConfigurationManager.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ - (void)initDefaultConfiguration {
118118
self.navBarShadowImageColor = UIColorMake(178, 178, 178);
119119
self.navBarBarTintColor = nil;
120120
self.navBarTintColor = self.blackColor;
121-
self.navBarTintColorHighlighted = [self.navBarTintColor colorWithAlphaComponent:self.navBarHighlightedAlpha];
122-
self.navBarTintColorDisabled = [self.navBarTintColor colorWithAlphaComponent:self.navBarDisabledAlpha];
123121
self.navBarTitleColor = nil;
124122
self.navBarTitleFont = UIFontBoldMake(17);
125123
self.navBarBackButtonTitlePositionAdjustment = UIOffsetZero;

QMUI/QMUIKit/UICommon/QMUIConfigurationTemplate.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ + (void)setupConfigurationTemplate {
109109
//- QMUICMI.navBarShadowImage = nil; // NavBarShadowImage
110110
//- QMUICMI.navBarBarTintColor = nil; // NavBarBarTintColor
111111
//- QMUICMI.navBarTintColor = UIColorBlack; // NavBarTintColor
112-
//- QMUICMI.navBarTintColorHighlighted = [NavBarTintColor colorWithAlphaComponent:NavBarHighlightedAlpha]; // NavBarTintColorHighlighted
113-
//- QMUICMI.navBarTintColorDisabled = [NavBarTintColor colorWithAlphaComponent:NavBarDisabledAlpha]; // NavBarTintColorDisabled
114112
//- QMUICMI.navBarTitleColor = NavBarTintColor; // NavBarTitleColor
115113
//- QMUICMI.navBarTitleFont = UIFontBoldMake(17); // NavBarTitleFont
116114
//- QMUICMI.navBarBackButtonTitlePositionAdjustment = UIOffsetZero; // NavBarBarBackButtonTitlePositionAdjustment

QMUI/QMUIKit/UIKitExtensions/QMUIButton.h

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ typedef enum {
3636
QMUINavigationButtonTypeNormal, // 普通导航栏文字按钮
3737
QMUINavigationButtonTypeBold, // 导航栏加粗按钮
3838
QMUINavigationButtonTypeImage, // 图标按钮
39-
QMUINavigationButtonTypeBack, // 自定义返回按钮(可以同时带有title)
40-
QMUINavigationButtonTypeClose, // 自定义关闭按钮(只显示icon不带title)
39+
QMUINavigationButtonTypeBack // 自定义返回按钮(可以同时带有title)
4140
} QMUINavigationButtonType;
4241

4342
typedef enum {
@@ -112,7 +111,11 @@ typedef NS_ENUM(NSInteger, QMUINavigationButtonPosition) {
112111

113112

114113
/**
115-
* `QMUINavigationButton`是用于UINavigationBar的按钮
114+
* QMUINavigationButton 是用于 UINavigationItem 的按钮,有两种使用方式:
115+
* 1. 利用类方法,快速生成所需的 UIBarButtonItem,其中大部分 UIBarButtonItem 均使用系统的 initWithBarButtonSystemItem 或 initWithImage 接口创建,仅有返回按钮利用了 customView 来创建 UIBarButtonItem。
116+
* 2. 利用 init 方法生成一个 QMUINavigationButton 实例,再通过类方法 + barButtonItemWithNavigationButton:position:target:action: 来生成一个对应的 UIBarButtonItem,此时 QMUINavigationButton 将作为 UIBarButtonItem 的 customView。
117+
* 若能满足需求,建议优先使用第 1 种方式。
118+
* @note 关于 tintColor:UIBarButtonItem 如果使用了 customView,则需要修改 customView.tintColor,如果没使用 customView,则直接修改 UIBarButtonItem.tintColor。
116119
*/
117120
@interface QMUINavigationButton : UIButton
118121

@@ -146,34 +149,96 @@ typedef NS_ENUM(NSInteger, QMUINavigationButtonPosition) {
146149
- (instancetype)initWithImage:(UIImage *)image;
147150

148151
/**
149-
* 创建一个返回按钮的UIBarButtonItem,默认使用没有tintColor的那个接口就好了。如果某些界面需要重新设置navBar的tintColor,则使用有tintColor的那个接口来兼容iOS6。
152+
* 创建一个 type 为 QMUINavigationButtonTypeBack 的 button 并作为 customView 用于生成一个 UIBarButtonItem,返回按钮的图片由配置表里的宏 NavBarBackIndicatorImage 决定。
153+
* @param target 按钮点击事件的接收者
154+
* @param selector 按钮点击事件的方法
155+
* @param tintColor 按钮要显示的颜色,如果为 nil,则表示跟随当前 UINavigationBar 的 tintColor
150156
*/
151157
+ (UIBarButtonItem *)backBarButtonItemWithTarget:(id)target action:(SEL)selector tintColor:(UIColor *)tintColor;
158+
159+
/**
160+
* 创建一个 type 为 QMUINavigationButtonTypeBack 的 button 并作为 customView 用于生成一个 UIBarButtonItem,返回按钮的图片由配置表里的宏 NavBarBackIndicatorImage 决定,按钮颜色跟随 UINavigationBar 的 tintColor。
161+
* @param target 按钮点击事件的接收者
162+
* @param selector 按钮点击事件的方法
163+
*/
152164
+ (UIBarButtonItem *)backBarButtonItemWithTarget:(id)target action:(SEL)selector;
153165

154166
/**
155-
* 创建一个关闭按钮的UIBarButtonItem,默认使用没有tintColor的那个接口就好了。如果某些界面需要重新设置navBar的tintColor,则使用有tintColor的那个接口来兼容iOS6。
167+
* 创建一个以 “×” 为图标的关闭按钮,图片由配置表里的宏 NavBarCloseButtonImage 决定。
168+
* @param target 按钮点击事件的接收者
169+
* @param selector 按钮点击事件的方法
170+
* @param tintColor 按钮要显示的颜色,如果为 nil,则表示跟随当前 UINavigationBar 的 tintColor
156171
*/
157172
+ (UIBarButtonItem *)closeBarButtonItemWithTarget:(id)target action:(SEL)selector tintColor:(UIColor *)tintColor;
173+
174+
/**
175+
* 创建一个以 “×” 为图标的关闭按钮,图片由配置表里的宏 NavBarCloseButtonImage 决定,图片颜色跟随 UINavigationBar.tintColor。
176+
* @param target 按钮点击事件的接收者
177+
* @param selector 按钮点击事件的方法
178+
*/
158179
+ (UIBarButtonItem *)closeBarButtonItemWithTarget:(id)target action:(SEL)selector;
159180

160-
/**
161-
* 创建一个特定type的UIBarButtonItem,默认使用没有tintColor的那个接口就好了。如果某些界面需要重新设置navBar的tintColor,则使用有tintColor的那个接口来兼容iOS6。
181+
/**
182+
* 创建一个 UIBarButtonItem
183+
* @param type 按钮的类型
184+
* @param title 按钮的标题
185+
* @param tintColor 按钮的颜色,如果为 nil,则表示跟随当前 UINavigationBar 的 tintColor
186+
* @param position 按钮在 UINavigationBar 上的左右位置,如果某一边的按钮有多个,则只有最左边(最右边)的按钮需要设置为 QMUINavigationButtonPositionLeft(QMUINavigationButtonPositionRight),靠里的按钮使用 QMUINavigationButtonPositionNone 即可
187+
* @param target 按钮点击事件的接收者
188+
* @param selector 按钮点击事件的方法
162189
*/
163190
+ (UIBarButtonItem *)barButtonItemWithType:(QMUINavigationButtonType)type title:(NSString *)title tintColor:(UIColor *)tintColor position:(QMUINavigationButtonPosition)position target:(id)target action:(SEL)selector;
191+
192+
/**
193+
* 创建一个 UIBarButtonItem
194+
* @param type 按钮的类型
195+
* @param title 按钮的标题
196+
* @param position 按钮在 UINavigationBar 上的左右位置,如果某一边的按钮有多个,则只有最左边(最右边)的按钮需要设置为 QMUINavigationButtonPositionLeft(QMUINavigationButtonPositionRight),靠里的按钮使用 QMUINavigationButtonPositionNone 即可
197+
* @param target 按钮点击事件的接收者
198+
* @param selector 按钮点击事件的方法
199+
*/
164200
+ (UIBarButtonItem *)barButtonItemWithType:(QMUINavigationButtonType)type title:(NSString *)title position:(QMUINavigationButtonPosition)position target:(id)target action:(SEL)selector;
165201

166202
/**
167-
* 以customView的方式用`QMUINavigationButton`创建一个UIBarButtonItem。position、target、selector等参数不需要对button设置,通过参数传进来就可以了。
203+
* 将参数传进来的 button 作为 customView 用于生成一个 UIBarButtonItem。
204+
* @param button 要作为 customView 的 QMUINavigationButton
205+
* @param tintColor 按钮的颜色,如果为 nil,则表示跟随当前 UINavigationBar 的 tintColor
206+
* @param position 按钮在 UINavigationBar 上的左右位置,如果某一边的按钮有多个,则只有最左边(最右边)的按钮需要设置为 QMUINavigationButtonPositionLeft(QMUINavigationButtonPositionRight),靠里的按钮使用 QMUINavigationButtonPositionNone 即可
207+
* @param target 按钮点击事件的接收者
208+
* @param selector 按钮点击事件的方法
168209
*
169-
* @warning 没有提供highLihgted和disabled的样式,需要在button自定义。
210+
* @note tintColor、position、target、selector 等参数不需要对 QMUINavigationButton 设置,通过参数传进来就可以了,就算设置了也会在这个方法里被覆盖。
211+
*/
212+
+ (UIBarButtonItem *)barButtonItemWithNavigationButton:(QMUINavigationButton *)button tintColor:(UIColor *)tintColor position:(QMUINavigationButtonPosition)position target:(id)target action:(SEL)selector;
213+
214+
/**
215+
* 将参数传进来的 button 作为 customView 用于生成一个 UIBarButtonItem。
216+
* @param button 要作为 customView 的 QMUINavigationButton
217+
* @param position 按钮在 UINavigationBar 上的左右位置,如果某一边的按钮有多个,则只有最左边(最右边)的按钮需要设置为 QMUINavigationButtonPositionLeft(QMUINavigationButtonPositionRight),靠里的按钮使用 QMUINavigationButtonPositionNone 即可
218+
* @param target 按钮点击事件的接收者
219+
* @param selector 按钮点击事件的方法
220+
*
221+
* @note position、target、selector 等参数不需要对 QMUINavigationButton 设置,通过参数传进来就可以了,就算设置了也会在这个方法里被覆盖。
170222
*/
171223
+ (UIBarButtonItem *)barButtonItemWithNavigationButton:(QMUINavigationButton *)button position:(QMUINavigationButtonPosition)position target:(id)target action:(SEL)selector;
172224

173225
/**
174-
* 创建一个图标类型的`UIBarButtonItem`
226+
* 创建一个图片类型的 UIBarButtonItem
227+
* @param image 按钮的图标
228+
* @param tintColor 按钮的颜色,如果为 nil,则表示跟随当前 UINavigationBar 的 tintColor
229+
* @param position 按钮在 UINavigationBar 上的左右位置,如果某一边的按钮有多个,则只有最左边(最右边)的按钮需要设置为 QMUINavigationButtonPositionLeft(QMUINavigationButtonPositionRight),靠里的按钮使用 QMUINavigationButtonPositionNone 即可
230+
* @param target 按钮点击事件的接收者
231+
* @param selector 按钮点击事件的方法
175232
*/
176233
+ (UIBarButtonItem *)barButtonItemWithImage:(UIImage *)image tintColor:(UIColor *)tintColor position:(QMUINavigationButtonPosition)position target:(id)target action:(SEL)selector;
234+
235+
/**
236+
* 创建一个图片类型的 UIBarButtonItem
237+
* @param image 按钮的图标
238+
* @param position 按钮在 UINavigationBar 上的左右位置,如果某一边的按钮有多个,则只有最左边(最右边)的按钮需要设置为 QMUINavigationButtonPositionLeft(QMUINavigationButtonPositionRight),靠里的按钮使用 QMUINavigationButtonPositionNone 即可
239+
* @param target 按钮点击事件的接收者
240+
* @param selector 按钮点击事件的方法
241+
*/
177242
+ (UIBarButtonItem *)barButtonItemWithImage:(UIImage *)image position:(QMUINavigationButtonPosition)position target:(id)target action:(SEL)selector;
178243

179244
/**

0 commit comments

Comments
 (0)