Skip to content

list_argokit

aisleep edited this page Dec 17, 2020 · 8 revisions

简介

用于显示排列在单列中的数据行的列表。

声明

public class List<D>: ScrollView

构造方法

init(style: UITableView.Style? = .plain, @ArgoKit.ArgoKitListBuilder content: @escaping () -> View) where D : ArgoKitNode

根据给定的内容创建一个列表

init(_ style: UITableView.Style? = .plain, data: [D], @ArgoKit.ArgoKitListBuilder rowContent: @escaping (D) -> View) where D : ArgoKit.ArgoKitIdentifiable

根据一个一维的数据源数组,创建一个只有一个章节的列表

init(_ style: UITableView.Style? = .plain, sectionData: [[D]], @ArgoKit.ArgoKitListBuilder rowContent: @escaping (D) -> View) where D : ArgoKit.ArgoKitIdentifiable

根据一个多维的数据源数组,创建一个多个章节的列表

API

func selectionStyle(_ value: UITableViewCell.SelectionStyle) -> Self

设置每行选中的样式

func separatorInset(_ value: UIEdgeInsets) -> Self

设置每行分割线的边缘缩进

func separatorInsetReference(_ value: UITableView.SeparatorInsetReference) -> Self

设置每行分割线的边缘缩进的参考系

func scrollToRow(at indexPath: IndexPath, at scrollPosition: UITableView.ScrollPosition, animated: Bool) -> Self

将列表滚动到指定的位置

func scrollToNearestSelectedRow(at scrollPosition: UITableView.ScrollPosition, animated: Bool) -> Self

将列表滚动到距离最近的选中的一行

func setEditing(_ editing: Bool, animated: Bool) -> Self

设置列表是否处于编辑状态

func allowsSelection(_ value: Bool) -> Self

设置列表是否允许被选中

func allowsSelectionDuringEditing(_ value: Bool) -> Self

设置列表是否允许在编辑状态时选中

func allowsMultipleSelection(_ value: Bool) -> Self

设置列表是否允许多选

func allowsMultipleSelectionDuringEditing(_ value: Bool) -> Self

设置列表是否允许在编辑状态多选

func selectRow(at indexPath: IndexPath?, animated: Bool, scrollPosition: UITableView.ScrollPosition) -> Self

选中指定行

func deselectRow(at indexPath: IndexPath, animated: Bool) -> Self

取消选中某一行

func sectionIndexMinimumDisplayRowCount(_ value: Int) -> Self

设置索引的最小显示行数。当行数达到此值时,在列表右侧显示特殊索引

func sectionIndexColor(_ value: UIColor?) -> Self

设置索引的字体颜色

func sectionIndexBackgroundColor(_ value: UIColor?) -> Self

设置索引的背景色

func sectionIndexTrackingBackgroundColor(_ value: UIColor?) -> Self

设置索引拖动时的背景色

func separatorStyle(_ value: UITableViewCell.SeparatorStyle) -> Self

设置列表每行分割线的样式

func separatorColor(_ value: UIColor?) -> Self

设置列表每行分割线的颜色

func separatorEffect(_ value: UIVisualEffect?) -> Self

设置列表每行分割的效果

func cellLayoutMarginsFollowReadableWidth(_ value: Bool) -> Self

设置列表每行布局的边缘是否是沿着可读部分的宽度

func insetsContentViewsToSafeArea(_ value: Bool) -> Self

设置列表内容是否根据安全区域缩进

func tableHeaderView(@ArgoKit.ArgoKitViewBuilder headerContent: @escaping () -> View) -> Self

设置列表的顶部视图

func tableFooterView(@ArgoKit.ArgoKitViewBuilder footerContent: @escaping () -> View) -> Self

设置列表的底部视图

func sectionHeader<T>(_ data: [T], @ArgoKit.ArgoKitListBuilder headerContent: @escaping (T) -> View) -> Self where T : ArgoKit.ArgoKitIdentifiable

设置每个章节的顶部视图

func sectionFooter<T>(_ data: [T], @ArgoKit.ArgoKitListBuilder footerContent: @escaping (T) -> View) -> Self where T : ArgoKit.ArgoKitIdentifiable

设置每个章节的底部视图

func remembersLastFocusedIndexPath(_ value: Bool) -> Self

设置是否记录最后一个聚焦的位置

func selectionFollowsFocus(_ value: Bool) -> Self

设置选中时是否跟随聚焦

func dragInteractionEnabled(_ value: Bool) -> Self

设置是否可以拖动列表

func reloadData(_ data: [D]? = nil, sectionHeaderData: ArgoKitIdentifiable? = nil, sectionFooterData: ArgoKitIdentifiable? = nil) -> Self where D : ArgoKit.ArgoKitIdentifiable

重新加载单章节数据

func reloadData(_ sectionData: [[D]]? = nil, sectionHeaderData: [ArgoKitIdentifiable]? = nil, sectionFooterData: [ArgoKitIdentifiable]? = nil) -> Self where D : ArgoKit.ArgoKitIdentifiable

重新加载多个章节数据

func reloadSections(_ sectionData: [[D]]? = nil, sectionHeaderData: [ArgoKitIdentifiable]? = nil, sectionFooterData: [ArgoKitIdentifiable]? = nil, sections: IndexSet, with animation: UITableView.RowAnimation) -> Self where D : ArgoKit.ArgoKitIdentifiable

重新加载指定章节数据

func appendSections(_ data: [[D]], sectionHeaderData: [ArgoKitIdentifiable]? = nil, sectionFooterData: [ArgoKitIdentifiable]? = nil, with animation: UITableView.RowAnimation) -> Self where D : ArgoKit.ArgoKitIdentifiable

在列表尾部增加新章节数据

func insertSections(_ data: [[D]], sectionHeaderData: [ArgoKitIdentifiable]? = nil, sectionFooterData: [ArgoKitIdentifiable]? = nil, at sections: IndexSet, with animation: UITableView.RowAnimation) -> Self where D : ArgoKit.ArgoKitIdentifiable

在指定位置插入新章节数据

func deleteSections(_ sections: IndexSet, with animation: UITableView.RowAnimation) -> Self

删除指定章节

func moveSection(_ section: Int, toSection newSection: Int) -> Self

移动某一章节数据

func reloadRows(_ rowData: [D]?, at indexPaths: [IndexPath], with animation: UITableView.RowAnimation) -> Self where D : ArgoKit.ArgoKitIdentifiable

重新加载指定行的数据

func appendRows(_ rowData: [D], at section: Int = 0, with animation: UITableView.RowAnimation) -> Self where D : ArgoKit.ArgoKitIdentifiable

在指定章节尾部增加新行数据

func insertRows(_ rowData: [D], at indexPaths: [IndexPath], with animation: UITableView.RowAnimation) -> Self where D : ArgoKit.ArgoKitIdentifiable

在指定位置插入新行数据

func deleteRows(at indexPaths: [IndexPath], with animation: UITableView.RowAnimation) -> Self

删除指定行的数据

func moveRow(at indexPath: IndexPath, to newIndexPath: IndexPath) -> Self

移动某一行数据

func canEditRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Bool) -> Self

设置选中行是否可以编辑的闭包

func canMoveRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Bool) -> Self

设置选中行是否可以移动的闭包

func sectionIndexTitles(_ value: [String]?) -> Self

设置右侧章节索引标题

func commitEditingRow(_ action: @escaping (_ editingStyle: UITableViewCell.EditingStyle, _ data: D, _ indexPath: IndexPath) -> Void) -> Self

设置提交选中行编辑状态的闭包

func moveRow(_ action: @escaping (_ sourceData: D, _ destinationData: D, _ sourceIndexPath: IndexPath, _ destinationIndexPath: IndexPath) -> Void) -> Self

设置移动选中行时的闭包

func prefetchRows(_ action: @escaping (_ indexPaths: [IndexPath]) -> Void) -> Self

设置预加载指定行的闭包

func cancelPrefetchingRows(_ action: @escaping (_ indexPaths: [IndexPath]) -> Void) -> Self

设置取消预加载指定行的闭包

func willDisplayRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Void) -> Self

设置指定行即将显示的闭包

func willDisplayHeaderView(_ action: @escaping (_ data: ArgoKitIdentifiable, _ section: Int) -> Void) -> Self

设置指定章节顶部视图即将显示的闭包

func willDisplayFooterView(_ action: @escaping (_ data: ArgoKitIdentifiable, _ section: Int) -> Void) -> Self

设置指定章节底部视图即将显示的闭包

func didEndDisplayingRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Void) -> Self

设置指定行结束展示时的闭包

func didEndDisplayingHeaderView(_ action: @escaping (_ data: ArgoKitIdentifiable, _ section: Int) -> Void) -> Self

设置指定章节顶部视图结束展示时的闭包

func didEndDisplayingFooterView(_ action: @escaping (_ data: ArgoKitIdentifiable, _ section: Int) -> Void) -> Self

设置指定章节底部视图结束展示时的闭包

func shouldHighlightRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Bool) -> Self

设置指定行是否可以高亮的闭包

func didHighlightRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Void) -> Self

设置指定行已经高亮的闭包

func didUnhighlightRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Void) -> Self

设置指定行结束高亮的闭包

func willSelectRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> IndexPath?) -> Self

设置指定行即将选中的闭包

func willDeselectRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> IndexPath?) -> Self

设置指定行即将取消选中的闭包

func didSelectRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Void) -> Self

设置指定行已经选中后的闭包

func didDeselectRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Void) -> Self

设置指定行已经取消选中的闭包

func editingStyle(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> UITableViewCell.EditingStyle) -> Self

设置指定行编辑样式的闭包

func titleForDeleteConfirmationButton(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> String?) -> Self

设置指定行删除按钮的标题的闭包

func editActions(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> [ListRowAction]?) -> Self

设置指定行的编辑按钮的闭包

func leadingSwipeActions(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> ListSwipeActionsConfiguration?) -> Self

设置指定行首部滑动按钮的闭包

func trailingSwipeActions(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> ListSwipeActionsConfiguration?) -> Self

设置指定行尾部滑动按钮的闭包

func shouldIndentWhileEditingRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Bool) -> Self

设置指定行是否允许在编辑状态背景缩进的闭包

func willBeginEditingRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Void) -> Self

设置指定行即将开始编辑的闭包

func didEndEditingRow(_ action: @escaping (_ data: D?, _ indexPath: IndexPath?) -> Void) -> Self

设置指定行已经结束编辑的闭包

func targetIndexPathForMove(_ action: @escaping (_ sourceData: D, _ proposedDestinationData: D, _ sourceIndexPath: IndexPath, _ proposedDestinationIndexPath: IndexPath) -> IndexPath) -> Self

设置指定行即将移动到目标位置的闭包

func indentationLevel(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Int) -> Self

设置指定行的缩进等级的闭包

func shouldShowMenu(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Bool) -> Self

设置指定行是否可以显示菜单的闭包

func canPerformAction(_ action: @escaping (_ action: Selector, _ data: D, _ indexPath: IndexPath, _ sender: Any?) -> Bool) -> Self

设置指定行是否可以执行某一操作的闭包

func performAction(_ action: @escaping (_ action: Selector, _ data: D, _ indexPath: IndexPath, _ sender: Any?) -> Void) -> Self

设置指定行执行某一操作的闭包

func canFocusRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Bool) -> Self

设置是否能够聚焦指定行的闭包

func shouldUpdateFocus(_ action: @escaping (_ context: UITableViewFocusUpdateContext) -> Bool) -> Self

设置是否能够更新聚集的闭包

func didUpdateFocus(_ action: @escaping (_ context: UITableViewFocusUpdateContext, _ coordinator: UIFocusAnimationCoordinator) -> Void) -> Self

设置已经更新聚焦的闭包

func indexPathForPreferredFocusedView(_ action: @escaping () -> IndexPath?) -> Self

设置聚焦位置的闭包

func shouldSpringLoadRow(_ action: @escaping (_ data: D, _ indexPath: IndexPath, _ context: UISpringLoadedInteractionContext) -> Bool) -> Self

设置是否可以弹性加载指定行的闭包

func shouldBeginMultipleSelectionInteraction(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Bool) -> Self

设置是否可以开始多选交互的闭包

func didBeginMultipleSelectionInteraction(_ action: @escaping (_ data: D, _ indexPath: IndexPath) -> Void) -> Self

设置已经多选交互的闭包

func didEndMultipleSelectionInteraction(_ action: @escaping () -> Void) -> Self

设置已经结束多选交互的闭包

func contextMenuConfiguration(_ action: @escaping (_ data: D, _ indexPath: IndexPath, _ point: CGPoint) -> UIContextMenuConfiguration?) -> Self

设置指定行上下文菜单的配置的闭包

func previewForHighlightingContextMenu(_ action: @escaping (_ configuration: UIContextMenuConfiguration) -> UITargetedPreview?) -> Self

设置高亮上下文菜单的预览的闭包

func previewForDismissingContextMenu(_ action: @escaping (_ configuration: UIContextMenuConfiguration) -> UITargetedPreview?) -> Self

设置消失中的上下文菜单的预览的闭包

func willPerformPreviewAction(_ action: @escaping (_ configuration: UIContextMenuConfiguration, _ animator: UIContextMenuInteractionCommitAnimating) -> Void) -> Self

设置将要执行预览操作的闭包

func willDisplayContextMenu(_ action: @escaping (_ configuration: UIContextMenuConfiguration, _ animator: UIContextMenuInteractionAnimating?) -> Void) -> Self

设置即将展示上下文菜单的闭包

func willEndContextMenuInteraction(_ action: @escaping (_ configuration: UIContextMenuConfiguration, _ animator: UIContextMenuInteractionAnimating?) -> Void) -> Self

设置即将结束的上下文菜单的闭包

Clone this wiki locally