Skip to content

list_argokit

aisleep edited this page Dec 11, 2020 · 8 revisions

简介

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

声明

public class List<Data> : ScrollView where Data : ArgoKit.ArgoKitIdentifiable

构造方法

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

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

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

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

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

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

API

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

设置每行选中的样式

separatorInset(_ value: UIEdgeInsets) -> Self

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

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

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

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

将列表滚动到指定的位置

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

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

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

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

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

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

allowsSelection(_ value: Bool) -> Self

设置列表是否允许被选中

allowsSelectionDuringEditing(_ value: Bool) -> Self

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

allowsMultipleSelection(_ value: Bool) -> Self

设置列表是否允许多选

allowsMultipleSelectionDuringEditing(_ value: Bool) -> Self

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

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

选中指定行

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

取消选中某一行

sectionIndexMinimumDisplayRowCount(_ value: Int) -> Self

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

sectionIndexColor(_ value: UIColor?) -> Self

设置索引的字体颜色

sectionIndexBackgroundColor(_ value: UIColor?) -> Self

设置索引的背景色

sectionIndexTrackingBackgroundColor(_ value: UIColor?) -> Self

设置索引拖动时的背景色

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

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

separatorColor(_ value: UIColor?) -> Self

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

separatorEffect(_ value: UIVisualEffect?) -> Self

设置列表每行分割的效果

cellLayoutMarginsFollowReadableWidth(_ value: Bool) -> Self

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

insetsContentViewsToSafeArea(_ value: Bool) -> Self

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

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

设置列表的顶部视图

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

设置列表的底部视图

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

设置每个章节的顶部视图

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

设置每个章节的底部视图

remembersLastFocusedIndexPath(_ value: Bool) -> Self

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

selectionFollowsFocus(_ value: Bool) -> Self

设置选中时是否跟随聚焦

dragInteractionEnabled(_ value: Bool) -> Self

设置是否可以拖动列表

reloadData(_ data: [Data]? = nil, sectionHeaderData: ArgoKitIdentifiable? = nil, sectionFooterData: ArgoKitIdentifiable? = nil)

重新加载单章节数据

reloadData(_ sectionData: [[Data]]? = nil, sectionHeaderData: [ArgoKitIdentifiable]? = nil, sectionFooterData: [ArgoKitIdentifiable]? = nil)

重新加载多个章节数据

reloadSections(_ sectionData: [[Data]]? = nil, sectionHeaderData: [ArgoKitIdentifiable]? = nil, sectionFooterData: [ArgoKitIdentifiable]? = nil, sections: IndexSet, with animation: UITableView.RowAnimation)

重新加载指定章节数据

appendSections(_ data: [[Data]], sectionHeaderData: [ArgoKitIdentifiable]? = nil, sectionFooterData: [ArgoKitIdentifiable]? = nil, with animation: UITableView.RowAnimation)

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

insertSections(_ data: [[Data]], sectionHeaderData: [ArgoKitIdentifiable]? = nil, sectionFooterData: [ArgoKitIdentifiable]? = nil, at sections: IndexSet, with animation: UITableView.RowAnimation)

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

deleteSections(_ sections: IndexSet, with animation: UITableView.RowAnimation)

删除指定章节

moveSection(_ section: Int, toSection newSection: Int)

移动某一章节数据

reloadRows(_ rowData: [Data]?, at indexPaths: [IndexPath], with animation: UITableView.RowAnimation)

重新加载指定行的数据

appendRows(_ rowData: [Data], at section: Int = 0, with animation: UITableView.RowAnimation)

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

insertRows(_ rowData: [Data], at indexPaths: [IndexPath], with animation: UITableView.RowAnimation)

在指定位置插入新行数据

deleteRows(at indexPaths: [IndexPath], with animation: UITableView.RowAnimation)

删除指定行的数据

moveRow(at indexPath: IndexPath, to newIndexPath: IndexPath)

移动某一行数据

titlesForHeaderInSection(_ value: [Int : String]?) -> Self

设置章节顶部标题

titlesForFooterInSection(_ value: [Int : String]?) -> Self

设置章节尾部标题

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

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

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

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

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

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

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

设置移动选中行时的闭包

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

设置预加载指定行的闭包

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

设置已经更新聚焦的闭包

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

设置聚焦位置的闭包

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

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

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

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

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

设置已经多选交互的闭包

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

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

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

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

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

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

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

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

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

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

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

设置即将消失的上下文菜单的闭包

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

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

Clone this wiki locally