123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- //
- // UIBarButtonItem+RQExtension.h
- // RQCommon
- //
- // Created by 张嵘 on 2018/11/16.
- // Copyright © 2018 张嵘. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- /// 获取系统颜色
- static inline UIColor *RQBarButtonItemTitleColor(BOOL useSystem) {
- return useSystem ? RQ_MAIN_TEXT_COLOR_2 : RQ_MAIN_TEXT_COLOR_2;
- }
- @interface UIBarButtonItem (RQExtension)
- /**
- 通过系统的方法,初始化一个UIBarButtonItem
-
- @param title 显示的文字,例如'完成'、'取消'
- @param titleColor title的颜色,if nil ,The Color is [UIColor whiteColor]
- @param imageName 图片名称
- @param target target
- @param selector selector
- @param textType 是否是纯文字
- @return init a UIBarButtonItem
- */
- + (UIBarButtonItem *)rq_systemItemWithTitle:(NSString *)title
- titleColor:(UIColor *)titleColor
- imageName:(NSString *)imageName
- target:(id)target
- selector:(SEL)selector
- textType:(BOOL)textType;
- /**
- 通过自定义的方法,快速初始化一个UIBarButtonItem,内部是按钮
-
- @param title 显示的文字,例如'完成'、'取消'
- @param font 文字的字体
- @param titleColor title的颜色,if nil ,The Color is [UIColor whiteColor]
- @param imageName 图片名称
- @param target target
- @param selector selector
- @param contentHorizontalAlignment 文本对齐方向
- @param edgeInsetsStyle titleLabel和imageView的布局样式
- @param space 文字图片间距
- @return UIBarButtonItem
- */
- + (UIBarButtonItem *)rq_customItemWithTitle:(NSString *)title
- font:(UIFont *)font
- titleColor:(UIColor *)titleColor
- imageName:(NSString *)imageName
- target:(id)target
- selector:(SEL)selector
- contentHorizontalAlignment:(UIControlContentHorizontalAlignment)contentHorizontalAlignment
- EdgeInsetsStyle:(RQButtonEdgeInsetsStyle)edgeInsetsStyle
- space:(CGFloat)space;
- /**
- 快速创建一个导航栏leftBarButtonItem 用于返回(pop)或者(dismiss),切记只能是纯图片 (eg: < or X)
- 且可以加大点击范围
- @param title title
- @param imageName 返回按钮的图片
- @param target target
- @param action action
- @return UIBarButtonItem Instance
- */
- + (UIBarButtonItem *)rq_backItemWithTitle:(NSString *)title
- imageName:(NSString *)imageName
- target:(id)target
- action:(SEL)action;
- @end
|