40 lines
990 B
C
40 lines
990 B
C
|
|
//
|
|||
|
|
// KBImagePositionButton.h
|
|||
|
|
// keyBoard
|
|||
|
|
//
|
|||
|
|
// Created by Kiro on 2026/1/27.
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
#import <UIKit/UIKit.h>
|
|||
|
|
|
|||
|
|
NS_ASSUME_NONNULL_BEGIN
|
|||
|
|
|
|||
|
|
/// 图片位置枚举
|
|||
|
|
typedef NS_ENUM(NSInteger, KBImagePosition) {
|
|||
|
|
KBImagePositionTop, // 图片在上,文字在下
|
|||
|
|
KBImagePositionBottom, // 图片在下,文字在上
|
|||
|
|
KBImagePositionLeft, // 图片在左,文字在右(默认)
|
|||
|
|
KBImagePositionRight // 图片在右,文字在左
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/// 可以指定图片位置的按钮
|
|||
|
|
@interface KBImagePositionButton : UIButton
|
|||
|
|
|
|||
|
|
/// 图片位置(默认 KBImagePositionLeft)
|
|||
|
|
@property (nonatomic, assign) KBImagePosition imagePosition;
|
|||
|
|
|
|||
|
|
/// 图片和文字之间的间距(默认 8)
|
|||
|
|
@property (nonatomic, assign) CGFloat spacing;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
便捷初始化方法
|
|||
|
|
|
|||
|
|
@param imagePosition 图片位置
|
|||
|
|
@param spacing 图片和文字之间的间距
|
|||
|
|
*/
|
|||
|
|
- (instancetype)initWithImagePosition:(KBImagePosition)imagePosition spacing:(CGFloat)spacing;
|
|||
|
|
|
|||
|
|
@end
|
|||
|
|
|
|||
|
|
NS_ASSUME_NONNULL_END
|