You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
5.3 KiB

/**
* Tencent is pleased to support the open source community by making QMUI_iOS available.
* Copyright (C) 2016-2020 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.
*/
//
// CALayer+QMUI.h
// qmui
//
// Created by QMUI Team on 16/8/12.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
typedef NS_OPTIONS (NSUInteger, QMUICornerMask) {
QMUILayerMinXMinYCorner = 1U << 0,
QMUILayerMaxXMinYCorner = 1U << 1,
QMUILayerMinXMaxYCorner = 1U << 2,
QMUILayerMaxXMaxYCorner = 1U << 3,
};
@interface CALayer (QMUI)
/// 是否为某个 UIView 自带的 layer
@property(nonatomic, assign, readonly) BOOL qmui_isRootLayerOfView;
/// 暂停/恢复当前 layer 上的所有动画
@property(nonatomic, assign) BOOL qmui_pause;
/**
* iOS11 QMUI
* @warning layer 使 QMUI_Border border clip
* @warning 使 qmui layer clip
* @warning 使 qmui_originCornerRadius iOS 11 0
*/
@property(nonatomic, assign) QMUICornerMask qmui_maskedCorners;
/// iOS11 以下 layer 自身的 cornerRadius 一直都是 0,圆角的是通过 mask 做的,qmui_originCornerRadius 保存了当前的圆角
@property(nonatomic, assign, readonly) CGFloat qmui_originCornerRadius;
/**
* sublayer sublayers
* @param sublayer layer
* @warning sublayer layer
*/
- (void)qmui_sendSublayerToBack:(CALayer *)sublayer;
/**
* sublayer sublayers
* @param sublayer layer
* @warning sublayer layer
*/
- (void)qmui_bringSublayerToFront:(CALayer *)sublayer;
/**
* CALayer CAShapeLayer CAGradientLayer便 layer 使
*/
- (void)qmui_removeDefaultAnimations;
/**
* CALayer CALayer
* @param actionsWithoutAnimation layer framebackgroundColor
* @note layer 使 qmui_removeDefaultAnimations
*/
+ (void)qmui_performWithoutAnimation:(void (NS_NOESCAPE ^)(void))actionsWithoutAnimation;
/**
* 线 CAShapeLayer
* @param lineLength 线
* @param lineSpacing 线
* @param lineWidth 线
* @param lineColor 线
* @param isHorizontal 线 YES NO
* dashPhase dashPattens
*/
+ (CAShapeLayer *)qmui_separatorDashLayerWithLineLength:(NSInteger)lineLength
lineSpacing:(NSInteger)lineSpacing
lineWidth:(CGFloat)lineWidth
lineColor:(CGColorRef)lineColor
isHorizontal:(BOOL)isHorizontal;
/**
* 线 layer PixelOne线 2线 2 UIColorSeparator CAShapeLayer
* InHorizon InVertical
*/
+ (CAShapeLayer *)qmui_separatorDashLayerInHorizontal;
+ (CAShapeLayer *)qmui_separatorDashLayerInVertical;
/**
* 线 layer PixelOne UIColorSeparator
*/
+ (CALayer *)qmui_separatorLayer;
/**
* 线 layer PixelOne TableViewSeparatorColor
*/
+ (CALayer *)qmui_separatorLayerForTableView;
@end
@interface CALayer (QMUI_DynamicColor)
/// 如果 layer 的 backgroundColor、borderColor、shadowColor 是使用 dynamic color(UIDynamicProviderColor、QMUIThemeColor 等)生成的,则调用这个方法可以重新设置一遍这些属性,从而更新颜色
/// iOS 13 系统设置里的界面样式变化(Dark Mode),以及 QMUIThemeManager 触发的主题变化,都会自动调用 layer 的这个方法,业务无需关心。
- (void)qmui_setNeedsUpdateDynamicStyle NS_REQUIRES_SUPER;
@end