FWViewWrapper

@interface FWViewWrapper : FWObjectWrapper

Undocumented

AutoLayout

  • 是否启用自动布局

    Declaration

    Objective-C

    @property (nonatomic) BOOL autoLayout;
  • 执行子视图自动布局,自动计算子视图尺寸。需先将视图添加到界面(如设置为tableHeaderView),再调用即可(iOS8+)

    Declaration

    Objective-C

    - (void)autoLayoutSubviews;
  • 计算动态布局视图指定宽度时的高度。使用AutoLayout必须约束完整,不使用AutoLayout会调用view的sizeThatFits:方法

    Declaration

    Objective-C

    - (CGFloat)layoutHeightWithWidth:(CGFloat)width;
  • 计算动态布局视图指定高度时的宽度。使用AutoLayout必须约束完整,不使用AutoLayout会调用view的sizeThatFits:方法

    Declaration

    Objective-C

    - (CGFloat)layoutWidthWithHeight:(CGFloat)height;

Compression

  • 设置水平方向抗压缩优先级

    Declaration

    Objective-C

    @property (nonatomic) UILayoutPriority compressionHorizontal;
  • 设置垂直方向抗压缩优先级

    Declaration

    Objective-C

    @property (nonatomic) UILayoutPriority compressionVertical;
  • 设置水平方向抗拉伸优先级

    Declaration

    Objective-C

    @property (nonatomic) UILayoutPriority huggingHorizontal;
  • 设置垂直方向抗拉伸优先级

    Declaration

    Objective-C

    @property (nonatomic) UILayoutPriority huggingVertical;

Collapse

  • 设置视图是否收缩,默认NO,YES时常量值为0,NO时常量值为原始值

    Declaration

    Objective-C

    @property (nonatomic) BOOL collapsed;
  • 设置视图是否自动收缩,如image为nil,text为nil、@“"时自动收缩,默认NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL autoCollapse;
  • 设置视图是否隐藏时自动收缩、显示时自动展开,默认NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL hiddenCollapse;
  • 添加视图的收缩常量,必须先添加才能生效

    Declaration

    Objective-C

    - (void)addCollapseConstraint:(nonnull NSLayoutConstraint *)constraint;

Axis

  • 父视图居中

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)alignCenterToSuperview;

    Return Value

    约束数组

  • 父视图居中偏移指定距离

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)alignCenterToSuperviewWithOffset:
        (CGPoint)offset;

    Parameters

    offset

    偏移距离

    Return Value

    约束数组

  • 父视图属性居中

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)alignAxisToSuperview:(NSLayoutAttribute)axis;

    Parameters

    axis

    居中属性

    Return Value

    布局约束

  • 父视图属性居中偏移指定距离

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)alignAxisToSuperview:(NSLayoutAttribute)axis
                                              withOffset:(CGFloat)offset;

    Parameters

    axis

    居中属性

    offset

    偏移距离

    Return Value

    布局约束

  • 与另一视图居中相同

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)alignAxis:(NSLayoutAttribute)axis
                                       toView:(nonnull id)otherView;

    Parameters

    axis

    居中属性

    otherView

    另一视图或UILayoutGuide,下同

    Return Value

    布局约束

  • 与另一视图居中偏移指定距离

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)alignAxis:(NSLayoutAttribute)axis
                                       toView:(nonnull id)otherView
                                   withOffset:(CGFloat)offset;

    Parameters

    axis

    居中属性

    otherView

    另一视图

    offset

    偏移距离

    Return Value

    布局约束

  • 与另一视图居中指定比例

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)alignAxis:(NSLayoutAttribute)axis
                                       toView:(nonnull id)otherView
                               withMultiplier:(CGFloat)multiplier;

    Parameters

    axis

    居中属性

    otherView

    另一视图

    multiplier

    指定比例

    Return Value

    布局约束

Edge

  • 与父视图四条边属性相同

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)pinEdgesToSuperview;

    Return Value

    约束数组

  • 与父视图四条边属性距离指定距离

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)pinEdgesToSuperviewWithInsets:
        (UIEdgeInsets)insets;

    Parameters

    insets

    指定距离insets

    Return Value

    约束数组

  • 与父视图三条边属性距离指定距离

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)
        pinEdgesToSuperviewWithInsets:(UIEdgeInsets)insets
                        excludingEdge:(NSLayoutAttribute)edge;

    Parameters

    insets

    指定距离insets

    edge

    排除的边

    Return Value

    约束数组

  • 与父视图水平方向两条边属性相同

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)pinEdgesToSuperviewHorizontal;

    Return Value

    约束数组

  • 与父视图垂直方向两条边属性相同

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)pinEdgesToSuperviewVertical;

    Return Value

    约束数组

  • 与父视图边属性相同

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)pinEdgeToSuperview:(NSLayoutAttribute)edge;

    Parameters

    edge

    指定边属性

    Return Value

    布局约束

  • 与父视图边属性偏移指定距离

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)pinEdgeToSuperview:(NSLayoutAttribute)edge
                                             withInset:(CGFloat)inset;

    Parameters

    edge

    指定边属性

    inset

    偏移距离

    Return Value

    布局约束

  • 与父视图边属性偏移指定距离,指定关系

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)pinEdgeToSuperview:(NSLayoutAttribute)edge
                                             withInset:(CGFloat)inset
                                              relation:(NSLayoutRelation)relation;

    Parameters

    edge

    指定边属性

    inset

    偏移距离

    relation

    约束关系

    Return Value

    布局约束

  • 与指定视图边属性相同

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)pinEdge:(NSLayoutAttribute)edge
                                     toEdge:(NSLayoutAttribute)toEdge
                                     ofView:(nonnull id)otherView;

    Parameters

    edge

    指定边属性

    toEdge

    另一视图边属性

    otherView

    另一视图

    Return Value

    布局约束

  • 与指定视图边属性偏移指定距离

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)pinEdge:(NSLayoutAttribute)edge
                                     toEdge:(NSLayoutAttribute)toEdge
                                     ofView:(nonnull id)otherView
                                 withOffset:(CGFloat)offset;

    Parameters

    edge

    指定边属性

    toEdge

    另一视图边属性

    otherView

    另一视图

    offset

    偏移距离

    Return Value

    布局约束

  • 与指定视图边属性偏移指定距离,指定关系

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)pinEdge:(NSLayoutAttribute)edge
                                     toEdge:(NSLayoutAttribute)toEdge
                                     ofView:(nonnull id)otherView
                                 withOffset:(CGFloat)offset
                                   relation:(NSLayoutRelation)relation;

    Parameters

    edge

    指定边属性

    toEdge

    另一视图边属性

    otherView

    另一视图

    offset

    偏移距离

    relation

    约束关系

    Return Value

    布局约束

SafeArea

  • 父视图安全区域居中。iOS11以下使用Superview实现,下同

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)alignCenterToSuperviewSafeArea;

    Return Value

    约束数组

  • 父视图安全区域居中偏移指定距离。iOS11以下使用Superview实现,下同

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)
        alignCenterToSuperviewSafeAreaWithOffset:(CGPoint)offset;

    Parameters

    offset

    偏移距离

    Return Value

    约束数组

  • 父视图安全区域属性居中

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)alignAxisToSuperviewSafeArea:
        (NSLayoutAttribute)axis;

    Parameters

    axis

    居中属性

    Return Value

    布局约束

  • 父视图安全区域属性居中偏移指定距离

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)alignAxisToSuperviewSafeArea:
                                        (NSLayoutAttribute)axis
                                                      withOffset:(CGFloat)offset;

    Parameters

    axis

    居中属性

    offset

    偏移距离

    Return Value

    布局约束

  • 与父视图安全区域四条边属性相同

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)pinEdgesToSuperviewSafeArea;

    Return Value

    约束数组

  • 与父视图安全区域四条边属性距离指定距离

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)
        pinEdgesToSuperviewSafeAreaWithInsets:(UIEdgeInsets)insets;

    Parameters

    insets

    指定距离insets

    Return Value

    约束数组

  • 与父视图安全区域三条边属性距离指定距离

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)
        pinEdgesToSuperviewSafeAreaWithInsets:(UIEdgeInsets)insets
                                excludingEdge:(NSLayoutAttribute)edge;

    Parameters

    insets

    指定距离insets

    edge

    排除的边

    Return Value

    约束数组

  • 与父视图安全区域水平方向两条边属性相同

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)
        pinEdgesToSuperviewSafeAreaHorizontal;

    Return Value

    约束数组

  • 与父视图安全区域垂直方向两条边属性相同

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)pinEdgesToSuperviewSafeAreaVertical;

    Return Value

    约束数组

  • 与父视图安全区域边属性相同

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)pinEdgeToSuperviewSafeArea:
        (NSLayoutAttribute)edge;

    Parameters

    edge

    指定边属性

    Return Value

    布局约束

  • 与父视图安全区域边属性偏移指定距离

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)pinEdgeToSuperviewSafeArea:
                                        (NSLayoutAttribute)edge
                                                     withInset:(CGFloat)inset;

    Parameters

    edge

    指定边属性

    inset

    偏移距离

    Return Value

    布局约束

  • 与父视图安全区域边属性偏移指定距离,指定关系

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)
        pinEdgeToSuperviewSafeArea:(NSLayoutAttribute)edge
                         withInset:(CGFloat)inset
                          relation:(NSLayoutRelation)relation;

    Parameters

    edge

    指定边属性

    inset

    偏移距离

    relation

    约束关系

    Return Value

    布局约束

Dimension

  • 设置宽高尺寸

    Declaration

    Objective-C

    - (nonnull NSArray<NSLayoutConstraint *> *)setDimensionsToSize:(CGSize)size;

    Parameters

    size

    尺寸大小

    Return Value

    约束数组

  • 设置某个尺寸

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)setDimension:(NSLayoutAttribute)dimension
                                          toSize:(CGFloat)size;

    Parameters

    dimension

    尺寸属性

    size

    尺寸大小

    Return Value

    布局约束

  • 设置某个尺寸,指定关系

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)setDimension:(NSLayoutAttribute)dimension
                                          toSize:(CGFloat)size
                                        relation:(NSLayoutRelation)relation;

    Parameters

    dimension

    尺寸属性

    size

    尺寸大小

    relation

    约束关系

    Return Value

    布局约束

  • 与视图自身尺寸属性指定比例

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)matchDimension:(NSLayoutAttribute)dimension
                                       toDimension:(NSLayoutAttribute)toDimension
                                    withMultiplier:(CGFloat)multiplier;

    Parameters

    dimension

    尺寸属性

    toDimension

    目标尺寸属性

    multiplier

    指定比例

    Return Value

    布局约束

  • 与视图自身尺寸属性指定比例,指定关系

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)matchDimension:(NSLayoutAttribute)dimension
                                       toDimension:(NSLayoutAttribute)toDimension
                                    withMultiplier:(CGFloat)multiplier
                                          relation:(NSLayoutRelation)relation;

    Parameters

    dimension

    尺寸属性

    toDimension

    目标尺寸属性

    multiplier

    指定比例

    relation

    约束关系

    Return Value

    布局约束

  • 与指定视图尺寸属性相同

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)matchDimension:(NSLayoutAttribute)dimension
                                       toDimension:(NSLayoutAttribute)toDimension
                                            ofView:(nonnull id)otherView;

    Parameters

    dimension

    尺寸属性

    toDimension

    目标尺寸属性

    otherView

    目标视图

    Return Value

    布局约束

  • 与指定视图尺寸属性相差指定大小

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)matchDimension:(NSLayoutAttribute)dimension
                                       toDimension:(NSLayoutAttribute)toDimension
                                            ofView:(nonnull id)otherView
                                        withOffset:(CGFloat)offset;

    Parameters

    dimension

    尺寸属性

    toDimension

    目标尺寸属性

    otherView

    目标视图

    offset

    相差大小

    Return Value

    布局约束

  • 与指定视图尺寸属性相差指定大小,指定关系

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)matchDimension:(NSLayoutAttribute)dimension
                                       toDimension:(NSLayoutAttribute)toDimension
                                            ofView:(nonnull id)otherView
                                        withOffset:(CGFloat)offset
                                          relation:(NSLayoutRelation)relation;

    Parameters

    dimension

    尺寸属性

    toDimension

    目标尺寸属性

    otherView

    目标视图

    offset

    相差大小

    relation

    约束关系

    Return Value

    布局约束

  • 与指定视图尺寸属性指定比例

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)matchDimension:(NSLayoutAttribute)dimension
                                       toDimension:(NSLayoutAttribute)toDimension
                                            ofView:(nonnull id)otherView
                                    withMultiplier:(CGFloat)multiplier;

    Parameters

    dimension

    尺寸属性

    toDimension

    目标尺寸属性

    otherView

    目标视图

    multiplier

    指定比例

    Return Value

    布局约束

  • 与指定视图尺寸属性指定比例,指定关系

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)matchDimension:(NSLayoutAttribute)dimension
                                       toDimension:(NSLayoutAttribute)toDimension
                                            ofView:(nonnull id)otherView
                                    withMultiplier:(CGFloat)multiplier
                                          relation:(NSLayoutRelation)relation;

    Parameters

    dimension

    尺寸属性

    toDimension

    目标尺寸属性

    otherView

    目标视图

    multiplier

    指定比例

    relation

    约束关系

    Return Value

    布局约束

Constrain

  • 与指定视图属性相同

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)constrainAttribute:(NSLayoutAttribute)attribute
                                           toAttribute:
                                               (NSLayoutAttribute)toAttribute
                                                ofView:(nullable id)otherView;

    Parameters

    attribute

    指定属性

    toAttribute

    目标视图属性

    otherView

    目标视图

    Return Value

    布局约束

  • 与指定视图属性偏移指定距离

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)constrainAttribute:(NSLayoutAttribute)attribute
                                           toAttribute:
                                               (NSLayoutAttribute)toAttribute
                                                ofView:(nullable id)otherView
                                            withOffset:(CGFloat)offset;

    Parameters

    attribute

    指定属性

    toAttribute

    目标视图属性

    otherView

    目标视图

    offset

    偏移距离

    Return Value

    布局约束

  • 与指定视图属性偏移指定距离,指定关系

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)constrainAttribute:(NSLayoutAttribute)attribute
                                           toAttribute:
                                               (NSLayoutAttribute)toAttribute
                                                ofView:(nullable id)otherView
                                            withOffset:(CGFloat)offset
                                              relation:(NSLayoutRelation)relation;

    Parameters

    attribute

    指定属性

    toAttribute

    目标视图属性

    otherView

    目标视图

    offset

    偏移距离

    relation

    约束关系

    Return Value

    布局约束

  • 与指定视图属性指定比例

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)constrainAttribute:(NSLayoutAttribute)attribute
                                           toAttribute:
                                               (NSLayoutAttribute)toAttribute
                                                ofView:(nullable id)otherView
                                        withMultiplier:(CGFloat)multiplier;

    Parameters

    attribute

    指定属性

    toAttribute

    目标视图属性

    otherView

    目标视图

    multiplier

    指定比例

    Return Value

    布局约束

  • 与指定视图属性指定比例,指定关系

    Declaration

    Objective-C

    - (nonnull NSLayoutConstraint *)constrainAttribute:(NSLayoutAttribute)attribute
                                           toAttribute:
                                               (NSLayoutAttribute)toAttribute
                                                ofView:(nullable id)otherView
                                        withMultiplier:(CGFloat)multiplier
                                              relation:(NSLayoutRelation)relation;

    Parameters

    attribute

    指定属性

    toAttribute

    目标视图属性

    otherView

    目标视图

    multiplier

    指定比例

    relation

    约束关系

    Return Value

    布局约束

Constraint

  • 最近一条添加或更新的布局约束

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSLayoutConstraint *lastConstraint;
  • 获取添加的与父视图属性的约束

    Declaration

    Objective-C

    - (nullable NSLayoutConstraint *)constraintToSuperview:
        (NSLayoutAttribute)attribute;

    Parameters

    attribute

    指定属性

    Return Value

    布局约束

  • 获取添加的与父视图属性的约束,指定关系

    Declaration

    Objective-C

    - (nullable NSLayoutConstraint *)
        constraintToSuperview:(NSLayoutAttribute)attribute
                     relation:(NSLayoutRelation)relation;

    Parameters

    attribute

    指定属性

    relation

    约束关系

    Return Value

    布局约束

  • 获取添加的与父视图安全区域属性的约束

    Declaration

    Objective-C

    - (nullable NSLayoutConstraint *)constraintToSuperviewSafeArea:
        (NSLayoutAttribute)attribute;

    Parameters

    attribute

    指定属性

    Return Value

    布局约束

  • 获取添加的与父视图安全区域属性的约束,指定关系

    Declaration

    Objective-C

    - (nullable NSLayoutConstraint *)
        constraintToSuperviewSafeArea:(NSLayoutAttribute)attribute
                             relation:(NSLayoutRelation)relation;

    Parameters

    attribute

    指定属性

    relation

    约束关系

    Return Value

    布局约束

  • 获取添加的与指定视图属性的约束

    Declaration

    Objective-C

    - (nullable NSLayoutConstraint *)constraint:(NSLayoutAttribute)attribute
                                    toAttribute:(NSLayoutAttribute)toAttribute
                                         ofView:(nullable id)otherView;

    Parameters

    attribute

    指定属性

    toAttribute

    目标视图属性

    otherView

    目标视图

    Return Value

    布局约束

  • 获取添加的与指定视图属性的约束,指定关系

    Declaration

    Objective-C

    - (nullable NSLayoutConstraint *)constraint:(NSLayoutAttribute)attribute
                                    toAttribute:(NSLayoutAttribute)toAttribute
                                         ofView:(nullable id)otherView
                                       relation:(NSLayoutRelation)relation;

    Parameters

    attribute

    指定属性

    toAttribute

    目标视图属性

    otherView

    目标视图

    relation

    约束关系

    Return Value

    布局约束

  • 获取添加的与指定视图属性指定比例的约束

    Declaration

    Objective-C

    - (nullable NSLayoutConstraint *)constraint:(NSLayoutAttribute)attribute
                                    toAttribute:(NSLayoutAttribute)toAttribute
                                         ofView:(nullable id)otherView
                                 withMultiplier:(CGFloat)multiplier;

    Parameters

    attribute

    指定属性

    toAttribute

    目标视图属性

    otherView

    目标视图

    multiplier

    指定比例

    Return Value

    布局约束

  • 获取添加的与指定视图属性指定比例的约束,指定关系

    Declaration

    Objective-C

    - (nullable NSLayoutConstraint *)constraint:(NSLayoutAttribute)attribute
                                    toAttribute:(NSLayoutAttribute)toAttribute
                                         ofView:(nullable id)otherView
                                 withMultiplier:(CGFloat)multiplier
                                       relation:(NSLayoutRelation)relation;

    Parameters

    attribute

    指定属性

    toAttribute

    目标视图属性

    otherView

    目标视图

    multiplier

    指定比例

    relation

    约束关系

    Return Value

    布局约束

Key

  • 设置约束保存键名,方便更新约束常量

    Declaration

    Objective-C

    - (void)setConstraint:(nullable NSLayoutConstraint *)constraint
                   forKey:(nonnull id<NSCopying>)key;

    Parameters

    constraint

    布局约束

    key

    保存key

  • 获取键名对应约束

    Declaration

    Objective-C

    - (nullable NSLayoutConstraint *)constraintForKey:(nonnull id<NSCopying>)key;

    Parameters

    key

    保存key

    Return Value

    布局约束

All

  • 获取当前所有约束,不包含Key

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSArray<NSLayoutConstraint *> *_Nonnull allConstraints;

    Return Value

    约束列表

  • 移除当前指定约束,不包含Key

    Declaration

    Objective-C

    - (void)removeConstraint:(nonnull NSLayoutConstraint *)constraint;
  • 移除当前所有约束,不包含Key

    Declaration

    Objective-C

    - (void)removeAllConstraints;

FWLayoutChain

  • 链式布局对象

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NS_SWIFT_UNAVAILABLE("") FWLayoutChain *layoutChain;
  • 链式布局句柄

    Declaration

    Objective-C

    - (void)layoutMaker:(nonnull void (^)(FWLayoutChain *_Nonnull))block;

FWBlock

  • 添加点击手势事件,默认子视图也会响应此事件。如要屏蔽之,解决方法:1、子视图设为UIButton;2、子视图添加空手势事件

    Declaration

    Objective-C

    - (void)addTapGestureWithTarget:(nonnull id)target action:(nonnull SEL)action;
  • 添加点击手势句柄,同上

    Declaration

    Objective-C

    - (nonnull NSString *)addTapGestureWithBlock:
        (nonnull void (^)(id _Nonnull))block;
  • 根据唯一标志移除点击手势句柄

    Declaration

    Objective-C

    - (void)removeTapGesture:(nullable NSString *)identifier;
  • 移除所有点击手势

    Declaration

    Objective-C

    - (void)removeAllTapGestures;

FWDebugger

  • 获取当前 UIView 层级树信息

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull viewInfo;
  • 是否需要添加debug背景色,默认NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL showDebugColor;
  • 是否每个view的背景色随机,如果不随机则统一使用半透明红色,默认NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL randomDebugColor;
  • 是否需要添加debug边框,默认NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL showDebugBorder;
  • 指定debug边框的颜色,默认半透明红色

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *_Nonnull debugBorderColor;

FWToolkit

  • top

    顶部纵坐标,frame.origin.y

    Declaration

    Objective-C

    @property (nonatomic) CGFloat top;
  • 底部纵坐标,frame.origin.y + frame.size.height

    Declaration

    Objective-C

    @property (nonatomic) CGFloat bottom;
  • 左边横坐标,frame.origin.x

    Declaration

    Objective-C

    @property (nonatomic) CGFloat left;
  • 右边横坐标,frame.origin.x + frame.size.width

    Declaration

    Objective-C

    @property (nonatomic) CGFloat right;
  • 宽度,frame.size.width

    Declaration

    Objective-C

    @property (nonatomic) CGFloat width;
  • 高度,frame.size.height

    Declaration

    Objective-C

    @property (nonatomic) CGFloat height;
  • 中心横坐标,center.x

    Declaration

    Objective-C

    @property (nonatomic) CGFloat centerX;
  • 中心纵坐标,center.y

    Declaration

    Objective-C

    @property (nonatomic) CGFloat centerY;
  • x

    起始横坐标,frame.origin.x

    Declaration

    Objective-C

    @property (nonatomic) CGFloat x;
  • y

    起始纵坐标,frame.origin.y

    Declaration

    Objective-C

    @property (nonatomic) CGFloat y;
  • 起始坐标,frame.origin

    Declaration

    Objective-C

    @property (nonatomic) CGPoint origin;
  • 大小,frame.size

    Declaration

    Objective-C

    @property (nonatomic) CGSize size;

FWUIKit

  • 视图是否可见,视图hidden为NO、alpha>0.01、window存在且size不为0才认为可见

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isViewVisible;
  • 获取响应的视图控制器

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) __kindof UIViewController *viewController;
  • 设置额外热区(点击区域)

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets touchInsets;
  • 设置阴影颜色、偏移和半径

    Declaration

    Objective-C

    - (void)setShadowColor:(nullable UIColor *)color
                    offset:(CGSize)offset
                    radius:(CGFloat)radius;
  • 绘制四边边框

    Declaration

    Objective-C

    - (void)setBorderColor:(nullable UIColor *)color width:(CGFloat)width;
  • 绘制四边边框和四角圆角

    Declaration

    Objective-C

    - (void)setBorderColor:(nullable UIColor *)color
                     width:(CGFloat)width
              cornerRadius:(CGFloat)radius;
  • 绘制四角圆角

    Declaration

    Objective-C

    - (void)setCornerRadius:(CGFloat)radius;
  • 绘制单边或多边边框Layer。frame必须存在(添加视图后可调用layoutIfNeeded更新frame)

    Declaration

    Objective-C

    - (void)setBorderLayer:(UIRectEdge)edge
                     color:(nullable UIColor *)color
                     width:(CGFloat)width;
  • 绘制单边或多边边框Layer。frame必须存在(添加视图后可调用layoutIfNeeded更新frame)

    Declaration

    Objective-C

    - (void)setBorderLayer:(UIRectEdge)edge
                     color:(nullable UIColor *)color
                     width:(CGFloat)width
                 leftInset:(CGFloat)leftInset
                rightInset:(CGFloat)rightInset;
  • 绘制单个或多个边框圆角,frame必须存在(添加视图后可调用layoutIfNeeded更新frame)

    Declaration

    Objective-C

    - (void)setCornerLayer:(UIRectCorner)corner radius:(CGFloat)radius;
  • 绘制单个或多个边框圆角和四边边框,frame必须存在(添加视图后可调用layoutIfNeeded更新frame)

    Declaration

    Objective-C

    - (void)setCornerLayer:(UIRectCorner)corner
                    radius:(CGFloat)radius
               borderColor:(nullable UIColor *)color
                     width:(CGFloat)width;
  • 绘制单边或多边边框视图。使用AutoLayout

    Declaration

    Objective-C

    - (void)setBorderView:(UIRectEdge)edge
                    color:(nullable UIColor *)color
                    width:(CGFloat)width;
  • 绘制单边或多边边框。使用AutoLayout

    Declaration

    Objective-C

    - (void)setBorderView:(UIRectEdge)edge
                    color:(nullable UIColor *)color
                    width:(CGFloat)width
                leftInset:(CGFloat)leftInset
               rightInset:(CGFloat)rightInset;