// // YMChoiceButton.h // MSYOUPAI // // Created by YoMi on 2022/9/20. // #import 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 @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 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