12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //
- // UIButton+YMImageLocation.h
- // MSYOUPAI
- //
- // Created by YoMi on 2024/3/9.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- NS_ASSUME_NONNULL_BEGIN
- typedef NS_ENUM(NSUInteger, YMImageLocationStyle) {
- /// 图片在左,文字在右
- YMImageLocationStyleLeft = 0,
- /// 图片在右,文字在左
- YMImageLocationStyleRight,
- /// 图片在上,文字在下
- YMImageLocationStyleTop,
- /// 图片在下,文字在上
- YMImageLocationStyleBottom,
- };
- @interface UIButton (YMImageLocation)
- /**
- * 设置图片与文字样式
- *
- * @param imageLocationStyle 图片位置样式
- * @param spacing 图片与文字之间的间距
- */
- - (void)ym_imageLocationStyle:(YMImageLocationStyle)imageLocationStyle spacing:(CGFloat)spacing;
- /**
- * 设置图片与文字样式(推荐使用)
- *
- * @param imageLocationStyle 图片位置样式
- * @param spacing 图片与文字之间的间距
- * @param imagePositionBlock 在此 Block 中设置按钮的图片、文字以及 contentHorizontalAlignment 属性
- */
- - (void)ym_imageLocationStyle:(YMImageLocationStyle)imageLocationStyle spacing:(CGFloat)spacing imageLocationBlock:(void (^)(UIButton *button))imagePositionBlock;
- @end
- NS_ASSUME_NONNULL_END
|