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

176 lines
6.9 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.
*/
//
// QMUIToastView.h
// qmui
//
// Created by QMUI Team on 2016/12/11.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class QMUIToastAnimator;
typedef NS_ENUM(NSInteger, QMUIToastViewPosition) {
QMUIToastViewPositionTop,
QMUIToastViewPositionCenter,
QMUIToastViewPositionBottom
};
/**
* `QMUIToastView`toast的控件`backgroundView``contentView`view都是通过外部赋值获取使`QMUIToastBackgroundView``QMUIToastContentView`
*
* `QMUIToastBackgroundView``QMUIToastContentView`QMUI提供的默认的viewview都可以通过appearance来修改样式view满足不了需求view来代替这两个viewQMUI也提供了默认的toastAnimator来实现ToastView的显示和隐藏动画`QMUIToastAnimator``QMUIToastAnimatorDelegate`
*
* tintColor toastView contentView.tintColor QMUIToastView.tintColor = UIColorWhite
*
* 使`QMUIToastView``QMUITips`
*
* @see QMUIToastBackgroundView
* @see QMUIToastContentView
* @see QMUIToastAnimator
* @see QMUITips
*/
@interface QMUIToastView : UIView
/**
* ToastView的唯一初始化方法`view`bound将会作为ToastView默认frame
*
* @param view ToastView的superView
*/
- (nonnull instancetype)initWithView:(nonnull UIView *)view NS_DESIGNATED_INITIALIZER;
/**
* parentView是ToastView初始化的时候传进去的那个view
*/
@property(nonatomic, weak, readonly) UIView *parentView;
/**
* ToastView
*
* @param animated
*
* @see toastAnimator
*/
- (void)showAnimated:(BOOL)animated;
/**
* ToastView
*
* @param animated
*
* @see toastAnimator
*/
- (void)hideAnimated:(BOOL)animated;
/**
* `delay`ToastView
*
* @param animated
* @param delay
*
* @see toastAnimator
*/
- (void)hideAnimated:(BOOL)animated afterDelay:(NSTimeInterval)delay;
/// @warning 如果使用 [QMUITips showXxx] 系列快捷方法来显示 tipswillShowBlock 将会在 show 之后才被设置,最终并不会被调用。这种场景建议自己在调用 [QMUITips showXxx] 之前执行一段代码,或者不要使用 [QMUITips showXxx] 的方式显示 tips
@property(nullable, nonatomic, copy) void (^willShowBlock)(UIView *showInView, BOOL animated);
@property(nullable, nonatomic, copy) void (^didShowBlock)(UIView *showInView, BOOL animated);
@property(nullable, nonatomic, copy) void (^willHideBlock)(UIView *hideInView, BOOL animated);
@property(nullable, nonatomic, copy) void (^didHideBlock)(UIView *hideInView, BOOL animated);
/**
* `QMUIToastAnimator`ToastView显示和隐藏的动画`QMUIToastAnimator``QMUIToastAnimatorDelegate`使`QMUIToastAnimator`
*/
@property(nullable, nonatomic, strong) QMUIToastAnimator *toastAnimator;
/**
* QMUIToastView的位置center
* top或者bottomToastView的布局规则是marginInsets.top开始往下布局(QMUIToastViewPositionTop) marginInsets.bottom开始往上布局(QMUIToastViewPositionBottom)
*/
@property(nonatomic, assign) QMUIToastViewPosition toastPosition;
/**
* ToastView隐藏的时候顺便把它从superView移除NO
*/
@property(nonatomic, assign) BOOL removeFromSuperViewWhenHide;
///////////////////
/**
* superViewToastView下面的内容
*/
@property(nonatomic, strong, readonly) UIView *maskView;
/**s
* Toast内容的UIViewcontentViewcontentView需要跟随ToastView的tintColor变化而变化view的`tintColorDidChange`使`QMUIToastContentView`
*/
@property(nonatomic, strong) __kindof UIView *contentView;
/**
* `contentView`UIView使`QMUIToastBackgroundView``QMUIToastBackgroundView` cornerRadius styleColor
*/
@property(nonatomic, strong) __kindof UIView *backgroundView;
///////////////////
/**
*
*/
@property(nonatomic, assign) CGPoint offset UI_APPEARANCE_SELECTOR;
/**
* ToastView parentView safeAreaInsets
*
* marginInsets.top = 0 toastPosition QMUIToastViewPositionTop parentView viewController.view tips navigationBar parentView navigationController.view tips statusBar
*/
@property(nonatomic, assign) UIEdgeInsets marginInsets UI_APPEARANCE_SELECTOR;
@end
@interface QMUIToastView (ToastTool)
/**
* `view` ToastView
*
* @param view ToastView superView view = nil ToastView
* @param animated
*
* @return ToastView YES NO
*/
+ (BOOL)hideAllToastInView:(UIView * _Nullable)view animated:(BOOL)animated;
/**
* `view` ToastView
*
* @param view ToastView superView
* @return QMUIToastView
*/
+ (nullable __kindof UIView *)toastInView:(UIView *)view;
/**
* `view` ToastView
*
* @param view ToastView superView
* @return view QMUIToastView view = nil ToastView
*/
+ (nullable NSArray <QMUIToastView *> *)allToastInView:(UIView *)view;
@end
NS_ASSUME_NONNULL_END