SYJUISwitch.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. //
  2. // SYJUISwitch.h
  3. // SYJUISwitch
  4. //
  5. // Created by syj on 2021/8/17.
  6. //
  7. #import <UIKit/UIKit.h>
  8. NS_ASSUME_NONNULL_BEGIN
  9. @interface SYJUISwitch : UIControl
  10. @property (nullable, nonatomic, strong) UIColor *onTintColor;
  11. @property (nullable, nonatomic, strong) UIColor *offTintColor;
  12. @property (nullable, nonatomic, strong) UIColor *thumbTintColor; //滑块颜色
  13. @property (nullable, nonatomic, strong) UIImage *onImage; //滑块image
  14. @property (nullable, nonatomic, strong) UIImage *offImage; //滑块image
  15. @property (nonatomic, assign) CGFloat tailLength; //滑块拖尾长度,default = 7.0
  16. @property (nonatomic, getter=isOn) BOOL on; //default = NO
  17. - (void)setOn:(BOOL)on animated:(BOOL)animated;
  18. @property (nonatomic, assign) CGFloat thumbLeftSpace; //滑块距离左边距离 default = 2.0
  19. @property (nonatomic, assign) CGFloat thumbTopSpace; //滑块距离右边距离 default = 2.0
  20. @property (nonatomic, assign) CGSize thumbSize; //滑块大小 default = (27, 27)
  21. - (void)setThumbLeftSpace:(CGFloat)thumbLeftSpace animated:(BOOL)animated;
  22. - (void)setThumbTopSpace:(CGFloat)thumbTopSpace animated:(BOOL)animated;
  23. - (void)setThumbSize:(CGSize)thumbSize animated:(BOOL)animated;
  24. @end
  25. NS_ASSUME_NONNULL_END