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

86 lines
4.0 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.
*/
//
// QMUINavigationButton.h
// QMUIKit
//
// Created by QMUI Team on 2018/4/9.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, QMUINavigationButtonType) {
QMUINavigationButtonTypeNormal, // 普通导航栏文字按钮
QMUINavigationButtonTypeBold, // 导航栏加粗按钮
QMUINavigationButtonTypeImage, // 图标按钮
QMUINavigationButtonTypeBack // 自定义返回按钮(可以同时带有title)
};
/**
* QMUINavigationButton
* UIBarButtonItem (QMUINavigationButton)便 UIBarButtonItem
* QMUINavigationButton customView UIBarButtonItem 使
* UIBarButtonItem iOS
*/
@interface QMUINavigationButton : UIButton
/**
* `QMUINavigationButtonType`
*/
@property(nonatomic, assign, readonly) QMUINavigationButtonType type;
/**
* UIBarButtonItem tintColor AlwaysTemplate
* YES
*/
@property(nonatomic, assign) BOOL adjustsImageTintColorAutomatically;
/**
*
* @param type
* @param title title
*/
- (instancetype)initWithType:(QMUINavigationButtonType)type title:(nullable NSString *)title;
/**
*
* @param type
*/
- (instancetype)initWithType:(QMUINavigationButtonType)type;
/**
*
* @param image image
*/
- (instancetype)initWithImage:(nullable UIImage *)image;
@end
@interface UIBarButtonItem (QMUINavigationButton)
+ (instancetype)qmui_itemWithButton:(QMUINavigationButton *)button target:(nullable id)target action:(nullable SEL)action;
+ (instancetype)qmui_itemWithImage:(UIImage *)image target:(nullable id)target action:(nullable SEL)action;
+ (instancetype)qmui_itemWithTitle:(NSString *)title target:(nullable id)target action:(nullable SEL)action;
+ (instancetype)qmui_itemWithBoldTitle:(NSString *)title target:(nullable id)target action:(nullable SEL)action;
+ (instancetype)qmui_backItemWithTitle:(nullable NSString *)title target:(nullable id)target action:(nullable SEL)action;
/// 返回一个返回按钮,该返回按钮的文字由配置表 NeedsBackBarButtonItemTitle 和 target 的值决定,如果 NeedsBackBarButtonItemTitle 为 NO则返回按钮不显示文字若为 YES则默认文字为“返回”但如果 target 为 UIViewController 则会自动获取上一个界面的 title 作为当前返回按钮的文字。
+ (instancetype)qmui_backItemWithTarget:(nullable id)target action:(nullable SEL)action;
/// 返回一个以“×”为图片的关闭按钮“x”的图片使用配置表 NavBarCloseButtonImage 设置
+ (instancetype)qmui_closeItemWithTarget:(nullable id)target action:(nullable SEL)action;
+ (instancetype)qmui_fixedSpaceItemWithWidth:(CGFloat)width;
+ (instancetype)qmui_flexibleSpaceItem;
@end
NS_ASSUME_NONNULL_END