cdts/xdts-ios 3/TreeHole/CYHResetCode/CYH/QMUIKit/QMUIComponents/QMUIButton/QMUIButton.h

113 lines
5.6 KiB
C
Raw 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.
*/
//
// QMUIButton.h
// qmui
//
// Created by QMUI Team on 14-7-7.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 控制图片在UIButton里的位置默认为QMUIButtonImagePositionLeft
typedef NS_ENUM(NSUInteger, QMUIButtonImagePosition) {
QMUIButtonImagePositionTop, // imageView在titleLabel上面
QMUIButtonImagePositionLeft, // imageView在titleLabel左边
QMUIButtonImagePositionBottom, // imageView在titleLabel下面
QMUIButtonImagePositionRight, // imageView在titleLabel右边
};
/**
* `QMUIButton.cornerRadius` `cornerRadius` `QMUIButtonCornerRadiusAdjustsBounds` `QMUIButton` `cornerRadius`使 1/2
*/
extern const CGFloat QMUIButtonCornerRadiusAdjustsBounds;
/**
*
* 1. tintColor UIButton tintColor
* 2.
* 3. highlighteddisabled alpha来表现 state titleColorimagealpha ButtonHighlightedAlphaButtonDisabledAlpha
* 4. highlightedBackgroundColor
* 5. highlightedBorderColor
* 6. titleLabel imagePosition
* 7. titleLabel titleEdgeInestsimageEdgeInsetsspacingBetweenImageAndTitle
* @warning QMUIButton UIButton.titleEdgeInestsimageEdgeInsetscontentEdgeInsets sizeThatFits: titleEdgeInests imageEdgeInsets UIButton 使使
*/
@interface QMUIButton : UIButton
/**
* initWithXxx
*/
- (void)didInitialize NS_REQUIRES_SUPER;
/**
* tintColor调整titleColor是不跟随的<br/>
* NO
*/
@property(nonatomic, assign) IBInspectable BOOL adjustsTitleTintColorAutomatically;
/**
* tintColor调整image是需要更改renderingMode才可以达到这种效果<br/>
* NO
*/
@property(nonatomic, assign) IBInspectable BOOL adjustsImageTintColorAutomatically;
/**
* adjustsTitleTintColorAutomatically = YES & adjustsImageTintColorAutomatically = YES & tintColor = xxx
* @warning nil
*/
@property(nonatomic, strong) IBInspectable UIColor *tintColorAdjustsTitleAndImage;
/**
* highlighted时的按钮样式YES<br/>
* YES时highlighted时会改变自身的alpha属性为<b>ButtonHighlightedAlpha</b>
*/
@property(nonatomic, assign) IBInspectable BOOL adjustsButtonWhenHighlighted;
/**
* disabled时的按钮样式YES<br/>
* YES时disabled时会改变自身的alpha属性为<b>ButtonDisabledAlpha</b>
*/
@property(nonatomic, assign) IBInspectable BOOL adjustsButtonWhenDisabled;
/**
* nil
* @warning highlightedBackgroundColor时adjustsButtonWhenHighlighted设为NO
* @see adjustsButtonWhenHighlighted
*/
@property(nonatomic, strong, nullable) IBInspectable UIColor *highlightedBackgroundColor;
/**
* nil
* @warning highlightedBorderColor时adjustsButtonWhenHighlighted设为NO
* @see adjustsButtonWhenHighlighted
*/
@property(nonatomic, strong, nullable) IBInspectable UIColor *highlightedBorderColor;
/**
* QMUIButtonImagePositionLeft<br/>
* imageEdgeInsetstitleEdgeInsetscontentHorizontalAlignmentcontentVerticalAlignment使用
*/
@property(nonatomic, assign) QMUIButtonImagePosition imagePosition;
/**
* imagePosition 0<br/>
* titleEdgeInsets imageEdgeInsets contentEdgeInsets 使<br/>
* @warning imageEdgeInsets titleEdgeInsets contentEdgeInsets
*/
@property(nonatomic, assign) IBInspectable CGFloat spacingBetweenImageAndTitle;
@property(nonatomic, assign) IBInspectable CGFloat cornerRadius UI_APPEARANCE_SELECTOR;// 默认为 0。将其设置为 QMUIButtonCornerRadiusAdjustsBounds 可自动保持圆角为按钮高度的一半。
@end
NS_ASSUME_NONNULL_END