2024-06-07 13:38:31 +08:00

43 lines
1.3 KiB
Objective-C

//
// RSButton.h
// Serendipity
//
// Created by HI_LOSER on 2022/10/18.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString * RSButtonStringFromControlState(UIControlState status);
typedef enum : NSUInteger {
RSButtonTypeAbove = 0, // 图片在文字上面
RSButtonTypeBelow, // 图片在文字下面
RSButtonTypeLeft, // 图片在文字左面
RSButtonTypeRight, // 图片在文字右面
RSButtonTypeOnlyImage, // 只有图片
RSButtonTypeOnlyTitle, // 只有文字
} RSButtonType;
@interface RSButton : UIControl
@property (strong, nonatomic, readonly) UILabel * titleLabel;
@property (strong, nonatomic, readonly) UIImageView * imageView;
@property (strong, nonatomic, readonly) UIImageView * backgroundImageView;
@property (assign, nonatomic) UIEdgeInsets insets;
@property (assign, nonatomic) CGFloat margin;
- (instancetype)initWithType:(RSButtonType)type;
- (void)setTitle:(NSString *) title forState:(UIControlState) state;
- (void)setTitleColor:(UIColor *) color forState:(UIControlState) state;
- (void)setImage:(UIImage *) image forState:(UIControlState) state;
-(void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;
- (void)setTitleFont:(UIFont *)titleFont;
@end
NS_ASSUME_NONNULL_END