UIButton+Extras.h
979 字节
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
//
// UIButton+Extras.h
// DreamSleep
//
// Created by peter on 2022/4/12.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSUInteger, UIButtonLayoutType) {
UIButtonLayoutTypeLeftTitleRightImage = 0,
UIButtonLayoutTypeUpImageBottomTitle = 1
};
NS_ASSUME_NONNULL_BEGIN
@interface UIButton (Extras)
+ (instancetype)btnWithTitle:(NSString *)title titleColor:(UIColor *)titleColor imgName:(NSString *)imgName font:(UIFont *)font;
/// 创建 UIButton
/// @param subTitle 二级 title
/// @param imgName 图片名
/// @param font 字体
+ (instancetype)dkBtnWithSubTitle:(NSString *)subTitle imgName:(NSString *)imgName font:(UIFont *)font;
/**
* 按钮中图片和标题布局方式(上下及左右)
*
* @param type 按钮布局类型
* @param midSpace 图片和标题间距
* @param sizeToFit 是否按尺寸调整
*/
- (void)adjustLayoutWithType:(UIButtonLayoutType)type midSpace:(CGFloat)midSpace sizeToFit:(BOOL)sizeToFit;
@end
NS_ASSUME_NONNULL_END