UIView+MT.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // UIView+MT.h
  3. //
  4. // Created by Simon on 2019/3/22.
  5. // Copyright © 2019 Simon. All rights reserved.
  6. //
  7. #import <UIKit/UIKit.h>
  8. NS_ASSUME_NONNULL_BEGIN
  9. @interface UIView (MT)
  10. //类别可以拓展属性,但是不能生成set和get方法
  11. @property (assign, nonatomic) CGFloat mt_x;
  12. @property (assign, nonatomic) CGFloat mt_y;
  13. @property (assign, nonatomic) CGFloat mt_width;
  14. @property (assign, nonatomic) CGFloat mt_height;
  15. @property (assign, nonatomic) CGSize mt_size;
  16. @property (assign, nonatomic) CGPoint mt_origin;
  17. // 圆角
  18. - (void) mt_yuanjiao:(CGFloat)radius;
  19. // 边框
  20. - (void) mt_biankuang:(CGFloat) width color:(UIColor *)color;
  21. // 关闭用户响应
  22. - (void) mt_closeUserInteractionOfSubViews;
  23. // 打开用户响应
  24. - (void) mt_openUserInteractionOfSubViews;
  25. // 隐藏
  26. - (void) mt_hideAllSubViews;
  27. // 展示
  28. - (void) mt_showAllSubViews;
  29. // 删除
  30. - (void) mt_removeAllSubViews;
  31. //部分圆角
  32. - (void)addRoundedCorners:(UIRectCorner)corners
  33. withRadii:(CGSize)radii
  34. viewRect:(CGRect)rect;
  35. /// 阴影
  36. /// @param shadowColor 阴影颜色
  37. /// @param shadowOffset 阴影偏移量(-x,-x)左上阴影 (0,0)全阴影 (x,x)右下阴影
  38. /// @param shadowOpacity 阴影透明度
  39. /// @param shadowRadius 阴影半径
  40. /// @param cornerRadius 圆角
  41. -(void)mt_shadowWithShadowColor:(UIColor *)shadowColor
  42. andShadowOffset:(CGSize)shadowOffset
  43. andShadowOpacity:(float )shadowOpacity
  44. andShadowRadius:(float)shadowRadius
  45. andCornerRadius:(float)cornerRadius;
  46. @end
  47. NS_ASSUME_NONNULL_END