39 lines
1.5 KiB
Objective-C
39 lines
1.5 KiB
Objective-C
//
|
|
// UIButton+EG.h
|
|
// EGCommon
|
|
//
|
|
// Created by donglyu on 2020/4/9.
|
|
// Copyright © 2020 Company. All rights reserved.
|
|
//
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
/*
|
|
针对同时设置了Image和Title的场景时UIButton中的图片和文字的关系
|
|
*/
|
|
typedef NS_ENUM(NSInteger, ButtonImageTitleStyle ) {
|
|
ButtonImageTitleStyleDefault = 0, //图片在左,文字在右,整体居中。
|
|
ButtonImageTitleStyleLeft = 1, //图片在左,文字在右,整体居中。
|
|
ButtonImageTitleStyleRight = 2, //图片在右,文字在左,整体居中。
|
|
ButtonImageTitleStyleTop = 3, //图片在上,文字在下,整体居中。
|
|
ButtonImageTitleStyleBottom = 4, //图片在下,文字在上,整体居中。
|
|
ButtonImageTitleStyleCenterTop = 5, //图片居中,文字在上距离按钮顶部。
|
|
ButtonImageTitleStyleCenterBottom = 6, //图片居中,文字在下距离按钮底部。
|
|
ButtonImageTitleStyleCenterUp = 7, //图片居中,文字在图片上面。
|
|
ButtonImageTitleStyleCenterDown = 8, //图片居中,文字在图片下面。
|
|
ButtonImageTitleStyleRightLeft = 9, //图片在右,文字在左,距离按钮两边边距
|
|
ButtonImageTitleStyleLeftRight = 10, //图片在左,文字在右,距离按钮两边边距
|
|
};
|
|
|
|
@interface UIButton (EG)
|
|
|
|
- (void)SetUpButtonImageTitleStyle:(ButtonImageTitleStyle)style padding:(CGFloat)padding;
|
|
|
|
- (void)AddTapBlock:(void(^)(UIButton*btn))block;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|