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

177 lines
8.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.
*/
//
// QMUIZoomImageView.h
// qmui
//
// Created by QMUI Team on 14-9-14.
//
#import <UIKit/UIKit.h>
#import <PhotosUI/PhotosUI.h>
#import "QMUIAsset.h"
@class QMUIZoomImageView;
@class QMUIEmptyView;
@class QMUIButton;
@class QMUIZoomImageViewVideoToolbar;
@class QMUIPieProgressView;
@protocol QMUIZoomImageViewDelegate <NSObject>
@optional
- (void)singleTouchInZoomingImageView:(QMUIZoomImageView *)zoomImageView location:(CGPoint)location;
- (void)doubleTouchInZoomingImageView:(QMUIZoomImageView *)zoomImageView location:(CGPoint)location;
- (void)longPressInZoomingImageView:(QMUIZoomImageView *)zoomImageView;
/**
* delegate iCloud
*/
- (void)didTouchICloudRetryButtonInZoomImageView:(QMUIZoomImageView *)imageView;
/**
* delegate
* @param didHide YES NO
*/
- (void)zoomImageView:(QMUIZoomImageView *)imageView didHideVideoToolbar:(BOOL)didHide;
/// 是否支持缩放,默认为 YES
- (BOOL)enabledZoomViewInZoomImageView:(QMUIZoomImageView *)zoomImageView;
@end
/**
* live photo
*
*
* contentMode live photo UIViewContentModeCenterUIViewContentModeScaleAspectFillUIViewContentModeScaleAspectFit UIViewContentModeCenter viewportRect zoomImageView
* @see viewportRect
*
* QMUIZoomImageView loading
*/
@interface QMUIZoomImageView : UIView <UIScrollViewDelegate>
@property(nonatomic, weak) id<QMUIZoomImageViewDelegate> delegate;
@property(nonatomic, strong, readonly) UIScrollView *scrollView;
/**
* viewportRect zoomImageView frame
* @note viewportRect
* @note viewportRect contentMode UIViewContentModeScaleAspectFill
* CGRectZero 使 zoomImageView
*/
@property(nonatomic, assign) CGRect viewportRect;
@property(nonatomic, assign) CGFloat maximumZoomScale;
@property(nonatomic, copy) NSObject<NSCopying> *reusedIdentifier;
/// 设置当前要显示的图片,会把 livePhoto/video 相关内容清空,因此注意不要直接通过 imageView.image 来设置图片。
@property(nonatomic, weak) UIImage *image;
/// 用于显示图片的 UIImageView注意不要通过 imageView.image 来设置图片,请使用 image 属性。
@property(nonatomic, strong, readonly) UIImageView *imageView;
/// 设置当前要显示的 Live Photo会把 image/video 相关内容清空,因此注意不要直接通过 livePhotoView.livePhoto 来设置
@property(nonatomic, weak) PHLivePhoto *livePhoto;
/// 用于显示 Live Photo 的 view仅在 iOS 9.1 及以后才有效
@property(nonatomic, strong, readonly) PHLivePhotoView *livePhotoView;
/// 设置当前要显示的 video ,会把 image/livePhoto 相关内容清空,因此注意不要直接通过 videoPlayerLayer 来设置
@property(nonatomic, weak) AVPlayerItem *videoPlayerItem;
/// 用于显示 video 的 layer
@property(nonatomic, weak, readonly) AVPlayerLayer *videoPlayerLayer;
// 播放 video 时底部的工具栏,你可通过此属性来拿到并修改上面的播放/暂停按钮、进度条、Label 等的样式
// @see QMUIZoomImageViewVideoToolbar
@property(nonatomic, strong, readonly) QMUIZoomImageViewVideoToolbar *videoToolbar;
// 视频底部控制条的 margins会在此基础上自动叠加 QMUIZoomImageView.safeAreaInsets因此无需考虑在 iPhone X 下的兼容
// 默认值为 {0, 25, 25, 18}
@property(nonatomic, assign) UIEdgeInsets videoToolbarMargins UI_APPEARANCE_SELECTOR;
// 播放 video 时屏幕中央的播放按钮
@property(nonatomic, strong, readonly) QMUIButton *videoCenteredPlayButton;
// 可通过此属性修改 video 播放时屏幕中央的播放按钮图片
@property(nonatomic, strong) UIImage *videoCenteredPlayButtonImage UI_APPEARANCE_SELECTOR;
// 从 iCloud 加载资源的进度展示
@property(nonatomic, strong) QMUIPieProgressView *cloudProgressView;
// 从 iCloud 加载资源失败的重试按钮
@property(nonatomic, strong) QMUIButton *cloudDownloadRetryButton;
// 当前展示的资源的下载状态
@property(nonatomic, assign) QMUIAssetDownloadStatus cloudDownloadStatus;
/// 暂停视频播放
- (void)pauseVideo;
/// 停止视频播放,将播放状态重置到初始状态
- (void)endPlayingVideo;
/// 获取当前正在显示的图片/视频的容器
@property(nonatomic, weak, readonly) __kindof UIView *contentView;
/**
* / QMUIZoomImageView rect
*/
- (CGRect)contentViewRectInZoomImageView;
/**
* 使
* super
*/
- (void)revertZooming;
@property(nonatomic, strong, readonly) QMUIEmptyView *emptyView;
/**
* loading
* @info cell / image/livePhoto/videoPlayerItem nil /
*/
- (void)showLoading;
/**
*
* @info cell / image/livePhoto/videoPlayerItem nil /
*/
- (void)showEmptyViewWithText:(NSString *)text;
- (void)showEmptyViewWithText:(NSString *)text
detailText:(NSString *)detailText
buttonTitle:(NSString *)buttonTitle
buttonTarget:(id)buttonTarget
buttonAction:(SEL)action;
/**
* emptyView
*/
- (void)hideEmptyView;
@end
@interface QMUIZoomImageViewVideoToolbar : UIView
@property(nonatomic, strong, readonly) QMUIButton *playButton;
@property(nonatomic, strong, readonly) QMUIButton *pauseButton;
@property(nonatomic, strong, readonly) UISlider *slider;
@property(nonatomic, strong, readonly) UILabel *sliderLeftLabel;
@property(nonatomic, strong, readonly) UILabel *sliderRightLabel;
// 可通过调整此属性来调整 toolbar 内部的间距,默认为 {0, 0, 0, 0}
@property(nonatomic, assign) UIEdgeInsets paddings UI_APPEARANCE_SELECTOR;
// 可通过这些属性修改 video 播放时屏幕底部工具栏的播放/暂停图标
@property(nonatomic, strong) UIImage *playButtonImage UI_APPEARANCE_SELECTOR;
@property(nonatomic, strong) UIImage *pauseButtonImage UI_APPEARANCE_SELECTOR;
@end