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

98 lines
4.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.
*/
//
// QMUIImagePreviewView.h
// qmui
//
// Created by QMUI Team on 2016/11/30.
//
#import <UIKit/UIKit.h>
#import "QMUIZoomImageView.h"
@class QMUIImagePreviewView;
@class QMUICollectionViewPagingLayout;
typedef NS_ENUM (NSUInteger, QMUIImagePreviewMediaType) {
QMUIImagePreviewMediaTypeImage,
QMUIImagePreviewMediaTypeLivePhoto,
QMUIImagePreviewMediaTypeVideo,
QMUIImagePreviewMediaTypeOthers
};
@protocol QMUIImagePreviewViewDelegate <QMUIZoomImageViewDelegate>
@required
- (NSUInteger)numberOfImagesInImagePreviewView:(QMUIImagePreviewView *)imagePreviewView;
- (void)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView renderZoomImageView:(QMUIZoomImageView *)zoomImageView atIndex:(NSUInteger)index;
@optional
// 返回要展示的媒体资源的类型图片、live photo、视频如果不实现此方法则 QMUIImagePreviewView 将无法选择最合适的 cell 来复用从而略微增大系统开销
- (QMUIImagePreviewMediaType)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView assetTypeAtIndex:(NSUInteger)index;
/**
*
* @param imagePreviewView QMUIImagePreviewView
* @param index
*/
- (void)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView didScrollToIndex:(NSUInteger)index;
/**
* /
* @param imagePreviewView QMUIImagePreviewView
* @param index
*/
- (void)imagePreviewView:(QMUIImagePreviewView *)imagePreviewView willScrollHalfToIndex:(NSUInteger)index;
@end
/**
* loading 使 UICollectionView cell UICollectionView 使 reloadDatacollectionViewLayout
*
* 使
*
* 1. 使 initWithFrame: init
* 2. delegate
* 3. delegate numberOfImagesInImagePreviewView:
* 4. delegate imagePreviewView:renderZoomImageView:atIndex: zoomImageView.image [zoomImageView showLoading] loading
* 5. QMUIImagePreviewViewDelegate QMUIZoomImageViewDelegate QMUIZoomImageViewDelegate
* 6. 使 currentImageIndex
*
* @see QMUIImagePreviewViewController
*/
@interface QMUIImagePreviewView : UIView<UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@property(nonatomic, weak) id<QMUIImagePreviewViewDelegate> delegate;
@property(nonatomic, strong, readonly) UICollectionView *collectionView;
@property(nonatomic, strong, readonly) QMUICollectionViewPagingLayout *collectionViewLayout;
/// 获取当前正在查看的图片 index也可强制将图片滚动到指定的 index
@property(nonatomic, assign) NSUInteger currentImageIndex;
- (void)setCurrentImageIndex:(NSUInteger)currentImageIndex animated:(BOOL)animated;
/// 每一页里的 loading 的颜色,默认为 UIColorWhite
@property(nonatomic, strong) UIColor *loadingColor;
@end
@interface QMUIImagePreviewView (QMUIZoomImageView) <QMUIZoomImageViewDelegate>
/**
* QMUIZoomImageView index
* @return zoomImageView index zoomImageView 0
*/
- (NSInteger)indexForZoomImageView:(QMUIZoomImageView *)zoomImageView;
/**
* index zoomImageView
* @return index zoomImageView index nil
*/
- (QMUIZoomImageView *)zoomImageViewAtIndex:(NSUInteger)index;
@end