123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- //
- // UIView+RQExtension.h
- // RQCommon
- //
- // Created by 张嵘 on 2018/11/16.
- // Copyright © 2018 张嵘. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- typedef void (^GestureActionBlock)(UIGestureRecognizer *gestureRecoginzer);
- @interface UIView (RQExtension)
- typedef NS_ENUM(NSInteger, GradientStyle) {
- GradientStyleLeftToRight = 1,//渐变左到右
- GradientStyleTopToBottom = 2//渐变上到下
- };
- /**
- * 判断一个控件是否真正显示在主窗口
- */
- - (BOOL)rq_isShowingOnKeyWindow;
- /**
- * xib创建的view
- */
- + (instancetype)rq_viewFromXib;
- /**
- * xib创建的view
- */
- + (instancetype)rq_viewFromXibWithFrame:(CGRect)frame;
- /**
- * xib中显示的属性
- */
- ///头部圆角
- @property (nonatomic, assign) IBInspectable BOOL roundTop;
- ///底部圆角
- @property (nonatomic, assign) IBInspectable BOOL roundBottom;
- ///左边圆角
- @property (nonatomic, assign) IBInspectable BOOL roundLeft;
- ///右边圆角
- @property (nonatomic, assign) IBInspectable BOOL roundRight;
- ///圆
- @property (nonatomic, assign) IBInspectable BOOL circle;
- ///圆角
- @property (nonatomic, assign) IBInspectable CGFloat cornerRadius;
- ///边框宽度
- @property (nonatomic, assign) IBInspectable CGFloat borderWidth;
- ///边框颜色
- @property (nonatomic, strong) IBInspectable UIColor *borderColor;
- ///阴影颜色
- @property (nonatomic, strong) IBInspectable UIColor *shadowColor;
- ///阴影半径 默认1
- @property (nonatomic, assign) IBInspectable CGFloat shadowRadius;
- ///阴影透明度 默认1
- @property (nonatomic, assign) IBInspectable CGFloat shadowOpacity;
- ///阴影偏移
- @property (nonatomic, assign) IBInspectable CGSize shadowOffset;
- ///是否开启主题渐变风格 (很多APP渐变风格大多数都是一致了.为了更快设置颜色而添加的属性,具体用法实现UIView+Theme方法)
- @property (nonatomic, assign) IBInspectable BOOL themeGradientEnable;
- ///渐变方向
- @property(nonatomic, assign) GradientStyle gradientStyle;
- ///渐变方向 xib用
- @property(nonatomic, assign) IBInspectable NSInteger gradientStyleEnum;
- ///渐变A颜色
- @property (nonatomic, strong) IBInspectable UIColor *gradientAColor;
- ///渐变B颜色
- @property (nonatomic, strong) IBInspectable UIColor *gradientBColor;
- /// 阴影Layer
- @property(nonatomic, strong) UIView *shadowView;
- // 渐变Layer
- @property(nonatomic, strong) CAGradientLayer *gradientLayer;
- // 边圆角Layer
- @property(nonatomic, strong) CAShapeLayer *maskLayer;
- ///上一次大小
- @property (nonatomic, copy) NSString *lastSize;
- /// < Shortcut for frame.origin.x.
- @property (nonatomic, readwrite, assign) CGFloat rq_left;
- /// < Shortcut for frame.origin.y
- @property (nonatomic, readwrite, assign) CGFloat rq_top;
- /// < Shortcut for frame.origin.x + frame.size.width
- @property (nonatomic, readwrite, assign) CGFloat rq_right;
- /// < Shortcut for frame.origin.y + frame.size.height
- @property (nonatomic, readwrite, assign) CGFloat rq_bottom;
- /// < Shortcut for frame.origin.x.
- @property (nonatomic, readwrite, assign) CGFloat rq_x;
- /// < Shortcut for frame.origin.y
- @property (nonatomic, readwrite, assign) CGFloat rq_y;
- /// < Shortcut for frame.size.width
- @property (nonatomic, readwrite, assign) CGFloat rq_width;
- /// < Shortcut for frame.size.height
- @property (nonatomic, readwrite, assign) CGFloat rq_height;
- /// < Shortcut for center.x
- @property (nonatomic, readwrite, assign) CGFloat rq_centerX;
- ///< Shortcut for center.y
- @property (nonatomic, readwrite, assign) CGFloat rq_centerY;
- /// < Shortcut for frame.size.
- @property (nonatomic, readwrite, assign) CGSize rq_size;
- /// < Shortcut for frame.origin.
- @property (nonatomic, readwrite, assign) CGPoint rq_origin;
- /**
- * @brief 添加tap手势
- * @param block 代码块
- */
- - (void)addTapActionWithBlock:(GestureActionBlock)block;
- /**
- * @brief 添加长按手势
- * @param block 代码块
- */
- - (void)addLongPressActionWithBlock:(GestureActionBlock)block;
- @end
|