12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- //
- // UIButton+RQExtension.h
- // XinShouJiaDao
- //
- // Created by 张嵘 on 2021/7/7.
- // Copyright © 2021 JCZ. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- NS_ASSUME_NONNULL_BEGIN
- // 定义一个枚举(包含了四种类型的button)
- typedef NS_ENUM(NSUInteger, RQButtonEdgeInsetsStyle) {
- RQButtonEdgeInsetsStyleTop, // image在上,label在下
- RQButtonEdgeInsetsStyleLeft, // image在左,label在右
- RQButtonEdgeInsetsStyleBottom, // image在下,label在上
- RQButtonEdgeInsetsStyleRight // image在右,label在左
- };
- @interface UIButton (RQExtension)
- /**默认的字体大小
- */
- - (void)setImage:(UIImage *)image withTitle:(NSString *)title forState:(UIControlState)stateType;
- - (void)setImage:(UIImage *)image withTitle:(NSString *)title Font:(CGFloat)font forState:(UIControlState)stateType;
- - (void)setTitle:(NSString*)title textColor:(UIColor*)color Font:(CGFloat)font fotState:(UIControlState)stateType;
- - (void)setImage:(UIImage *)image withTitle:(NSString*)title textColor:(UIColor*)color Font:(CGFloat)font fotState:(UIControlState)stateType;
- /**简化按钮事件添加。要求一定要实现btnClick;
- */
- -(void)target:(id)obj;
- -(void)target:(id)obj tag:(NSInteger)tag;
- -(void)setTitleNormal:(NSString*)title;
- -(void)setTitleSelect:(NSString*)title;
- /**
- * 设置button的titleLabel和imageView的布局样式,及间距
- *
- * @param style titleLabel和imageView的布局样式
- * @param space titleLabel和imageView的间距
- */
- - (void)layoutButtonWithEdgeInsetsStyle:(RQButtonEdgeInsetsStyle)style
- imageTitleSpace:(CGFloat)space;
- @end
- NS_ASSUME_NONNULL_END
|