萤石云 iOSSDK,移植跨平台相关工程
Davin
2024-12-18 b4e1288a9b63eb820e9c9489c56aac4bf6b31067
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
//  HDLEZOPButton.h
//  EZSDK
//
//  Created by Davin on 2023/6/20.
//
 
#import <UIKit/UIKit.h>
 
NS_ASSUME_NONNULL_BEGIN
 
/// 控制图片在UIButton里的位置,默认为HDLOPButtonImagePositionLeft
typedef NS_ENUM(NSUInteger, HDLEZOPButtonImagePosition) {
    HDLEZOPButtonImagePositionTop,             // imageView在titleLabel上面
    HDLEZOPButtonImagePositionLeft,            // imageView在titleLabel左边
    HDLEZOPButtonImagePositionBottom,          // imageView在titleLabel下面
    HDLEZOPButtonImagePositionRight,           // imageView在titleLabel右边
};
 
@interface HDLEZOPButton : UIButton
 
/**
 *  子类继承时重写的方法,一般不建议重写 initWithXxx
 */
- (void)didInitialize NS_REQUIRES_SUPER;
 
/**
 * 让按钮的文字颜色自动跟随tintColor调整(系统默认titleColor是不跟随的)<br/>
 * 默认为NO
 */
@property(nonatomic, assign) IBInspectable BOOL adjustsTitleTintColorAutomatically;
 
/**
 * 让按钮的图片颜色自动跟随tintColor调整(系统默认image是需要更改renderingMode才可以达到这种效果)<br/>
 * 默认为NO
 */
@property(nonatomic, assign) IBInspectable BOOL adjustsImageTintColorAutomatically;
 
/**
 *  等价于 adjustsTitleTintColorAutomatically = YES & adjustsImageTintColorAutomatically = YES & tintColor = xxx
 *  @warning 不支持传 nil
 */
@property(nonatomic, strong) IBInspectable UIColor *tintColorAdjustsTitleAndImage;
 
/**
 * 是否自动调整highlighted时的按钮样式,默认为YES。<br/>
 * 当值为YES时,按钮highlighted时会改变自身的alpha属性为<b>ButtonHighlightedAlpha</b>
 */
@property(nonatomic, assign) IBInspectable BOOL adjustsButtonWhenHighlighted;
 
/**
 * 是否自动调整disabled时的按钮样式,默认为YES。<br/>
 * 当值为YES时,按钮disabled时会改变自身的alpha属性为<b>ButtonDisabledAlpha</b>
 */
@property(nonatomic, assign) IBInspectable BOOL adjustsButtonWhenDisabled;
 
/**
 * 设置按钮点击时的背景色,默认为nil。
 * @warning 不支持带透明度的背景颜色。当设置highlightedBackgroundColor时,会强制把adjustsButtonWhenHighlighted设为NO,避免两者效果冲突。
 * @see adjustsButtonWhenHighlighted
 */
@property(nonatomic, strong, nullable) IBInspectable UIColor *highlightedBackgroundColor;
 
/**
 * 设置按钮点击时的边框颜色,默认为nil。
 * @warning 当设置highlightedBorderColor时,会强制把adjustsButtonWhenHighlighted设为NO,避免两者效果冲突。
 * @see adjustsButtonWhenHighlighted
 */
@property(nonatomic, strong, nullable) IBInspectable UIColor *highlightedBorderColor;
 
/**
 * 设置按钮里图标和文字的相对位置,默认为HDLOPButtonImagePositionLeft<br/>
 * 可配合imageEdgeInsets、titleEdgeInsets、contentHorizontalAlignment、contentVerticalAlignment使用
 */
@property(nonatomic, assign) HDLEZOPButtonImagePosition imagePosition;
 
/**
 * 设置按钮里图标和文字之间的间隔,会自动响应 imagePosition 的变化而变化,默认为0。<br/>
 * 系统默认实现需要同时设置 titleEdgeInsets 和 imageEdgeInsets,同时还需考虑 contentEdgeInsets 的增加(否则不会影响布局,可能会让图标或文字溢出或挤压),使用该属性可以避免以上情况。<br/>
 * @warning 会与 imageEdgeInsets、 titleEdgeInsets、 contentEdgeInsets 共同作用。
 */
@property(nonatomic, assign) IBInspectable CGFloat spacingBetweenImageAndTitle;
 
@property(nonatomic, assign) IBInspectable CGFloat cornerRadius UI_APPEARANCE_SELECTOR;// 默认为 0。将其设置为 HDLOPButtonCornerRadiusAdjustsBounds 可自动保持圆角为按钮高度的一半。
 
@end
 
NS_ASSUME_NONNULL_END