cdts/xdts-ios 3/TreeHole/CYHResetCode/CYH/QMUIKit/QMUIMainFrame/QMUICommonTableViewController.h

98 lines
5.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.
*/
//
// QMUICommonTableViewController.h
// qmui
//
// Created by QMUI Team on 14-6-24.
//
#import "QMUICommonViewController.h"
#import "QMUITableView.h"
NS_ASSUME_NONNULL_BEGIN
extern NSString *const QMUICommonTableViewControllerSectionHeaderIdentifier;
extern NSString *const QMUICommonTableViewControllerSectionFooterIdentifier;
/**
* `UITableViewController` `QMUICommonViewController` `UITableViewController`
*
* `initWithStyle:` `UITableViewStylePlain` 使 `init`
*
*
*
* 1. `QMUISearchController` `shouldShowSearchBar` searchBar searchController QMUICommonTableViewController (Search)
* 2. tableView:titleForHeaderInSection: sectionHeader viewForHeaderInSection:heightForHeaderInSection:
* 3. QMUIEmptyView tableView subview loading
*
* @note emptyView tableHeaderView tableView tableHeaderView tableFooterView cells layoutEmptyView
*
* @see QMUISearchController
*/
@interface QMUICommonTableViewController : QMUICommonViewController<QMUITableViewDelegate, QMUITableViewDataSource>
- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
/**
* NS_DESIGNATED_INITIALIZER NS_DESIGNATED_INITIALIZER NS_DESIGNATED_INITIALIZER
*/
- (void)didInitializeWithStyle:(UITableViewStyle)style NS_REQUIRES_SUPER;
/// 获取当前的 `UITableViewStyle`
@property(nonatomic, assign, readonly) UITableViewStyle style;
/// 当前的 tableView如果需要使用自定义的 tableView class可重写 initTableView 并在里面通过 self.tableView = xxx 为 tableView 赋值,注意需要自行指定 dataSource 和 delegate 但不需要 add 到 self.view 上。
/// @note 直接把自定义 tableView 赋值给 self.tableView 也可以,但 QMUI 将会多余地创建一次 QMUITableView会造成浪费。
#if !TARGET_INTERFACE_BUILDER
@property(nonatomic, strong, null_resettable) IBOutlet __kindof QMUITableView *tableView;
#else
@property(nonatomic, strong, null_resettable) IBOutlet QMUITableView *tableView;
#endif
- (void)hideTableHeaderViewInitialIfCanWithAnimated:(BOOL)animated force:(BOOL)force;
@end
@interface QMUICommonTableViewController (QMUISubclassingHooks)
/**
* tableView tableView getter self.tableView = xxx tableView class dataSource delegate add self.view tableView的设置属性的代码都应该写在这里
*
* @note self.tableView = xxx super
* @example
* - (void)initTableView {
* self.tableView = [MyTableView alloc] initWithFrame:self.view.bounds style:self.style];
* self.tableView.dataSource = self;
* self.tableView.delegate = self;
* }
*/
- (void)initTableView;
/**
* tableView 便 tableView.frame super viewDidLayoutSubviews super tableView.frame
* self.view super
*/
- (void)layoutTableView;
/**
* tableHeaderView隐藏self.tableView.contentOffset实现
*
* NO
*
* @see QMUITableViewDelegate
*/
- (BOOL)shouldHideTableHeaderViewInitial;
@end
NS_ASSUME_NONNULL_END