123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- //
- // YMChoiceButton.h
- // MSYOUPAI
- //
- // Created by YoMi on 2022/9/20.
- //
- #import <UIKit/UIKit.h>
- NS_ASSUME_NONNULL_BEGIN
- @class YMChoiceButton;
- @protocol YMChoiceButtonDelegate;
- typedef NS_ENUM(NSInteger, YMChoiceButtonStatusType) {
- YMChoiceButtonStatusTypeCancel = 0,
- YMChoiceButtonStatusTypeSelect = 1,
- };
- typedef NS_ENUM(NSInteger, YMChoiceButtonClickStateType) {
- YMChoiceButtonNoClickableState = 0,
- YMChoiceButtonClickableState = 1,
- };
- typedef NS_ENUM(NSInteger, YMChoiceType) {
- YMChoiceTypeRadio = 0,
- YMChoiceTypeCheck = 1,
- };
- @protocol YMChoiceButtonDelegate <NSObject>
- @required
- -(void)ym_choiceButtonSelectedAtIndex:(NSUInteger)index inGroup:(NSString*)groupId;
- -(void)ym_choiceButtonCancelAtIndex:(NSUInteger)index inGroup:(NSString*)groupId;
- @end
- @interface YMChoiceButton: UIButton
- {
- NSString *_groupId;
- NSUInteger _index;
- YMChoiceButtonStatusType _statustype;
- YMChoiceType _choiceType;
-
- }
- @property (nonatomic, readonly) NSString* groupId;
- @property (nonatomic, readonly) YMChoiceType choiceType;
- @property (nonatomic, assign, readwrite) id<YMChoiceButtonDelegate> delegate;
- @property (nonatomic, assign, readwrite) YMChoiceButtonStatusType statusType;
- //仅仅是对ChoiceTypeRadio状态下面有效
- @property (nonatomic, assign, readwrite) BOOL mustChooseOne;
- @property (nonatomic, assign, readwrite) NSUInteger index;
- + (id)buttonWithFrame:(CGRect)frame andChoiceType:(YMChoiceType)choiceType withIndex:(NSUInteger)index inGroup:(NSString*)groupId withSelectedImage:(UIImage*)selectedImage andNormalImage:(UIImage*)normalImage;
- @end
- NS_ASSUME_NONNULL_END
|