WMZCodeView.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // WMZCodeView.h
  3. // WMZCode
  4. //
  5. // Created by wmz on 2018/12/14.
  6. // Copyright © 2018年 wmz. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. /*
  10. * CodeType type
  11. */
  12. typedef NS_ENUM(NSInteger, CodeType) {
  13. CodeTypeImage = 0, // DefaultImage
  14. CodeTypeLabel, // Label
  15. CodeTypeNineLabel, // NineLabel
  16. CodeTypeSlider // Slider
  17. };
  18. typedef void (^callBack) (BOOL success);
  19. NS_ASSUME_NONNULL_BEGIN
  20. @interface WMZCodeView : UIView
  21. /*
  22. * 初始化
  23. */
  24. + (instancetype)shareInstance;
  25. /*
  26. * 调用方法
  27. *
  28. * @param CodeType 类型
  29. * @param name 背景图
  30. * @param rect frame
  31. * @param block 回调
  32. *
  33. */
  34. - (WMZCodeView*)addCodeViewWithType:(CodeType)type
  35. withImageName:(NSString*)name
  36. witgFrame:(CGRect)rect
  37. withBlock:(callBack)block;
  38. @end
  39. @interface WMZSlider : UISlider
  40. @property(nonatomic,strong)UILabel *label;
  41. @end
  42. typedef NS_ENUM(NSInteger,DWContentMode)//图片填充模式
  43. {
  44. DWContentModeScaleAspectFit,//适应模式
  45. DWContentModeScaleAspectFill,//填充模式
  46. DWContentModeScaleToFill//拉伸模式
  47. };
  48. @interface UIImage (Expand)
  49. ///截取当前image对象rect区域内的图像
  50. -(UIImage *)dw_SubImageWithRect:(CGRect)rect;
  51. ///压缩图片至指定尺寸
  52. -(UIImage *)dw_RescaleImageToSize:(CGSize)size;
  53. ///按给定path剪裁图片
  54. /**
  55. path:路径,剪裁区域。
  56. mode:填充模式
  57. */
  58. -(UIImage *)dw_ClipImageWithPath:(UIBezierPath *)path mode:(DWContentMode)mode;
  59. //裁剪图片
  60. - (UIImage*)imageScaleToSize:(CGSize)size;
  61. @end
  62. NS_ASSUME_NONNULL_END