cdts/xdts-ios 3/TreeHole/CYHResetCode/CYH/QMUIKit/UIKitExtensions/UIView+QMUIBorder.h

74 lines
4.6 KiB
C
Raw Permalink Normal View History

2023-07-27 09:20:00 +08:00
/**
* Tencent is pleased to support the open source community by making QMUI_iOS available.
* Copyright (C) 2016-2021 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
//
// UIView+QMUIBorder.h
// QMUIKit
//
// Created by MoLice on 2020/6/28.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_OPTIONS(NSUInteger, QMUIViewBorderPosition) {
QMUIViewBorderPositionNone = 0,
QMUIViewBorderPositionTop = 1 << 0,
QMUIViewBorderPositionLeft = 1 << 1,
QMUIViewBorderPositionBottom = 1 << 2,
QMUIViewBorderPositionRight = 1 << 3
};
typedef NS_ENUM(NSUInteger, QMUIViewBorderLocation) {
QMUIViewBorderLocationInside,
QMUIViewBorderLocationCenter,
QMUIViewBorderLocationOutside
};
/**
* UIView (QMUIBorder) UIView 便
*
* UIView view.layer view.layer UIView (QMUIBorder) qmui_borderPosition
* @warning UIView 使 view.layer UIView (QMUIBorder) QMUIViewBorderPosition QMUIViewBorderPositionAll
*/
@interface UIView (QMUIBorder)
/// 设置边框的位置,默认为 QMUIViewBorderLocationInside与 view.layer.border 一致。
@property(nonatomic, assign) QMUIViewBorderLocation qmui_borderLocation;
/// 设置边框类型,支持组合,例如:`borderPosition = QMUIViewBorderPositionTop|QMUIViewBorderPositionBottom`。默认为 QMUIViewBorderPositionNone。
@property(nonatomic, assign) QMUIViewBorderPosition qmui_borderPosition;
/// 边框的大小默认为PixelOne。请注意修改 qmui_borderPosition 的值以将边框显示出来。
@property(nonatomic, assign) IBInspectable CGFloat qmui_borderWidth;
/**
UIEdgeInsetsZero线borderInsets top/left/bottom/right
1. QMUIViewBorderPositionTop left right top bottom
2. QMUIViewBorderPositionLeft left right top bottom
3. QMUIViewBorderPositionBottom left right top bottom
4. QMUIViewBorderPositionRight left right top bottom
*/
@property(nonatomic, assign) IBInspectable UIEdgeInsets qmui_borderInsets;
/// 边框的颜色默认为UIColorSeparator。请注意修改 qmui_borderPosition 的值以将边框显示出来。
@property(nullable, nonatomic, strong) IBInspectable UIColor *qmui_borderColor;
/// 虚线 : dashPhase默认是0且当dashPattern设置了才有效
/// qmui_dashPhase 表示虚线起始的偏移qmui_dashPattern 可以传一个数组表示“lineWidthlineSpacinglineWidthlineSpacing...”的顺序,至少传 2 个。
@property(nonatomic, assign) CGFloat qmui_dashPhase;
@property(nullable, nonatomic, copy) NSArray<NSNumber *> *qmui_dashPattern;
/// border的layer
@property(nullable, nonatomic, strong, readonly) CAShapeLayer *qmui_borderLayer;
@end
NS_ASSUME_NONNULL_END