//
//  UIView+XVAdd.h
//  fastservice
//
//  Created by xuning on 2/3/24.
//  Copyright © 2024 FastService. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIView (XVAdd)

#pragma mark - 设置部分圆角
/**
 *  设置部分圆角(绝对布局)
 *
 *  @param corners 需要设置为圆角的角 UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners
 *  @param radii   需要设置的圆角大小 例如 CGSizeMake(20.0f, 20.0f)
 */
- (void)addRoundedCorners:(UIRectCorner)corners
                withRadii:(CGSize)radii;
/**
 *  设置部分圆角(相对布局)
 *
 *  @param corners 需要设置为圆角的角 UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners
 *  @param radii   需要设置的圆角大小 例如 CGSizeMake(20.0f, 20.0f)
 *  @param rect    需要设置的圆角view的rect
 */
- (void)addRoundedCorners:(UIRectCorner)corners
                withRadii:(CGSize)radii
                 viewRect:(CGRect)rect;

@end


@interface UILabel (XVAdd)



/**
 便利构造函数

 @param text text description
 @param color color description
 @param alignment alignment description
 @param size size description
 @return YDLable
 */
- (instancetype)initWithText:(NSString *)text textColor:(UIColor *)color textAlignment:(NSTextAlignment)alignment fontSize:(CGFloat)size;

/**
 *  改变行间距
 */
+ (void)changeLineSpaceForLabel:(UILabel *)label WithSpace:(float)space;

/**
 *  改变字间距
 */
+ (void)changeWordSpaceForLabel:(UILabel *)label WithSpace:(float)space;

/**
 *  改变行间距和字间距
 */
+ (void)changeSpaceForLabel:(UILabel *)label withLineSpace:(float)lineSpace WordSpace:(float)wordSpace;



@end


@interface UIButton (XVAdd)

@property (nonatomic, assign) NSTimeInterval cs_acceptEventInterval;   // 可以用这个给重复点击加间隔
/**
 自定义响应边界 UIEdgeInsetsMake(-3, -4, -5, -6). 表示扩大
 例如： self.btn.hitEdgeInsets = UIEdgeInsetsMake(-3, -4, -5, -6);
 */
@property(nonatomic, assign) UIEdgeInsets hitEdgeInsets;


/**
 自定义响应边界 自定义的边界的范围 范围扩大3.0,frame 必须是确定的!
 如果没有效果,请打印frame
 例如：self.btn.hitScale = 3.0;
 */
@property(nonatomic, assign) CGFloat hitScale;

/*
 自定义响应边界 自定义的宽度的范围 范围扩大3.0 frame 必须是确定的!
 如果没有效果,请打印frame
 例如：self.btn.hitWidthScale = 3.0;
 */
@property(nonatomic, assign) CGFloat hitWidthScale;

/*
 自定义响应边界 自定义的高度的范围 范围扩大3.0 frame 必须是确定的!
 如果没有效果,请打印frame
 例如：self.btn.hitHeightScale = 3.0;
 */
@property(nonatomic, assign) CGFloat hitHeightScale;
/**
 便利构造函数

 @param title title description
 @param size size description
 @param titleColor titleColor description
 @param imageName imageName description
 @param selectedImgName selectedImgName description
 @param backgroundColor backgroundColor description
 @return YDButton
 */
- (instancetype)initWithTitle:(NSString *)title fontSize:(CGFloat)size titleColor:(UIColor *)titleColor normalImageName:(NSString *)imageName selectedImgName:(NSString *)selectedImgName backgroundColor:(UIColor *)backgroundColor;

- (instancetype)initWithTitle:(NSString *)title fontSize:(CGFloat)size normalTitleColor:(UIColor *)normalTitleColor selectTitleColor:(UIColor *)selectTitleColor normalImgColor:(UIColor *)normalImgColor selectedImgColor:(UIColor *)selectedImgColor;

- (instancetype)initWithTitle:(NSString *)title fontSize:(CGFloat)size titleColor:(UIColor *)titleColor bgColor:(UIColor *)bgColor;

- (instancetype)initWithNormalImageName:(NSString *)imageName selectedImgName:(NSString *)selectedImgName;
// 设置左字右图
- (void)setForceRightToLeft:(CGFloat)spacing forState:(UIControlState)state;

@end

@interface UIImageView (XVAdd)


/**
 便利构造函数

 @param imageNamed imageName description
 @return YDImageView
 */
- (instancetype)initWithImageName:(NSString *)imageNamed;

@end



NS_ASSUME_NONNULL_END
