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

84 lines
4.2 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.
*/
//
// QMUIStaticTableViewCellDataSource.h
// qmui
//
// Created by QMUI Team on 2017/6/20.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class QMUIStaticTableViewCellData;
@class QMUIStaticTableViewCellDataSource;
@class QMUITableViewCell;
/**
* 便 cell cell 使
* 1. UITableView viewController
* 2. init initWithCellDataSections: dataSource init tableView viewDidLoad cellDataSections
* 3. 2 dataSource tableView.qmui_staticCellDataSource
* 4. UITableViewDataSourceUITableViewDelegate viewController QMUIStaticTableViewCellDataSource (Manual) QMUI Demo
*/
@interface QMUIStaticTableViewCellDataSource : NSObject
/// 列表的数据源,是一个二维数组,其中一维表示 section二维表示某个 section 里的 rows每次调用这个属性的 setter 方法都会自动刷新 tableView 内容。
@property(nonatomic, copy) NSArray<NSArray<QMUIStaticTableViewCellData *> *> *cellDataSections;
/// 数据源绑定到的列表,在 UITableView (QMUI_StaticCell) 里会被赋值
@property(nonatomic, weak, readonly) UITableView *tableView;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithCellDataSections:(NSArray<NSArray<QMUIStaticTableViewCellData *> *> *)cellDataSections NS_DESIGNATED_INITIALIZER;
@end
/// 当需要重写某些 UITableViewDataSource、UITableViewDelegate 方法时,这个分类里提供的同名方法需要在该方法中被调用,否则可能导致 QMUIStaticTableViewCellData 里设置的一些值无效。
@interface QMUIStaticTableViewCellDataSource (Manual)
/**
* dataSource indexPath QMUIStaticTableViewCellData
* @param indexPath cell
*/
- (QMUIStaticTableViewCellData *)cellDataAtIndexPath:(NSIndexPath *)indexPath;
/**
* dataSource indexPath cell reuseIdentifierstatic tableView cell reuseIdentifier
* @param indexPath cell
*/
- (NSString *)reuseIdentifierForCellAtIndexPath:(NSIndexPath *)indexPath;
/**
* indexPath dataSource cell cell 使 QMUITableViewCell
* @prama indexPath cell indexPath
*/
- (__kindof QMUITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath;
/**
* dataSource cell
* @prama indexPath cell indexPath
* @return cell
*/
- (CGFloat)heightForRowAtIndexPath:(NSIndexPath *)indexPath;
/**
* tableView:didSelectRowAtIndexPath: dataSource indexPath cellData target action
* @param indexPath cell indexPath
*/
- (void)didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
/**
* tableView:accessoryButtonTappedForRowWithIndexPath: dataSource indexPath cellData target action
* @param indexPath cell indexPath
*/
- (void)accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath;
@end