[작성중] UITableViewDelegate

YesCoach·2021년 7월 7일
0

UITableViewDelegate 공식 문서

테이블 뷰에서 셀렉션 관리, 섹션 헤더 및 푸터 구성, 셀 삭제 및 재정렬, 기타 등의 작업을 수행하는 메서드들

Declaration

@MainActor protocol UITableViewDelegate

Overview

이 프로토콜의 메소드를 사용하여 다음 기능을 관리합니다.

  • 커스텀 헤더 및 푸터 뷰를 생성하고 관리합니다.
  • 행, 헤더 및 푸터의 커스텀 높이를 지정합니다.
  • 더 나은 스크롤 지원을 위해 높이 견적을 제공합니다.
  • 행 내용을 들여씁니다.
  • 행 선택에 응답합니다.
  • 테이블 행의 스와이프 및 기타 작업에 응답합니다.
  • 테이블 내용 편집을 지원합니다.

테이블뷰는 NSIndexPath 객체를 사용하여 행과 섹션을 지정합니다. 행 및 섹션 인덱스를 해석하는 방법에 대한 자세한 내용은 Specifying the Location of Rows and Sections을 참조하세요.

Topics

Configuring Rows for the Table View

  • func tableView(UITableView, willDisplay: UITableViewCell, forRowAt: IndexPath)
    델리게이트에게 테이블뷰가 특정 행에 셀을 그리려고 함(will display)을 알립니다.
  • func tableView(UITableView, indentationLevelForRowAt: IndexPath) -> Int
    델리게이트에게 주어진 섹션에 있는 행의 들여쓰기 레벨을 반환하도록 요청합니다.
  • func tableView(UITableView, shouldSpringLoadRowAt: IndexPath, with: UISpringLoadedInteractionContext) -> Bool
    테이블에서 행의 spring-loading 동작을 미세 조정할 수 있게 하기 위해 호출됩니다.

Responding to Row Selections

  • Handling Row Selection in a Table View
    앱이 다음으로 표시되는 작업을 수행할 수 있도록 유저가 테이블뷰 셀을 탭하는 것을 탐지합니다.
  • Selecting Multiple Items with a Two-Finger Pan Gesture
    테이블 및 컬렉션뷰에서 다중 선택 제스처를 사용하여 사용자의 여러 항목 선택을 가속화합니다.
  • func tableView(UITableView, willSelectRowAt: IndexPath) -> IndexPath?
    델리게이트에게 행이 선택되려고 함을 알립니다.
  • func tableView(UITableView, didSelectRowAt: IndexPath)
    델리게이트에게 행을 선택했음을 알립니다.
  • func tableView(UITableView, willDeselectRowAt: IndexPath) -> IndexPath?
    델리게이트에게 지정된 행이 선택 취소 되려고 함을 알립니다.
  • func tableView(UITableView, didDeselectRowAt: IndexPath)
    델리게이트에게 지정된 행이 선택 취소되었음을 알립니다.
  • func tableView(UITableView, shouldBeginMultipleSelectionInteractionAt: IndexPath) -> Bool
    델리게이트에게 사용자가 두 손가락 이동 제스처를 사용하여 테이블뷰에서 여러 항목을 선택할 수 있는지 여부를 묻습니다.
  • func tableView(UITableView, didBeginMultipleSelectionInteractionAt: IndexPath)
    사용자가 두 손가락 이동 제스처를 사용하여 테이블뷰에서 여러 행을 선택하면 델리게이트에게 알립니다.
  • func tableViewDidEndMultipleSelectionInteraction(UITableView)
    사용자가 두 손가락 이동 제스처를 사용해서 테이블뷰에서 여러 행을 선택하는 것을 중지하면 딜리게이트에게 알립니다.

  • func tableView(UITableView, viewForHeaderInSection: Int) -> UIView?
    델리게이트에게 테이블뷰의 지정된 섹션 헤더에 표시할 뷰를 요청합니다.
  • func tableView(UITableView, viewForFooterInSection: Int) -> UIView?
    델리게이트에게 테이블뷰의 지정된 섹션 푸터에 표시할 뷰를 요청합니다.
  • func tableView(UITableView, willDisplayHeaderView: UIView, forSection: Int)
    델리게이트에게 테이블이 지정된 섹션에 대한 헤더 뷰를 표시하려고 함을 알립니다.
  • func tableView(UITableView, willDisplayFooterView: UIView, forSection: Int)
    델리게이트에게 테이블이 지정된 섹션에 대한 푸터 뷰를 표시하려고 함을 알립니다.

  • func tableView(UITableView, heightForRowAt: IndexPath) -> CGFloat
    델리게이트에게 지정된 위치의 행에 사용할 높이를 요청합니다.
  • func tableView(UITableView, heightForHeaderInSection: Int) -> CGFloat
    델리게이트에게 특정 섹션의 헤더에 사용할 높이를 요청합니다.
  • func tableView(UITableView, heightForFooterInSection: Int) -> CGFloat
    델리게이트에게 특정 섹션의 푸터에 사용할 높이를 요청합니다.
  • class let automaticDimension: CGFloat
    지정된 차원에 대한 기본값을 나타내는 상수입니다.

Estimating Heights for the Table's Content

  • func tableView(UITableView, estimatedHeightForRowAt: IndexPath) -> CGFloat
    델리게이트에게 지정된 위치에 있는 행의 예상 높이를 요청합니다.
  • func tableView(UITableView, estimatedHeightForHeaderInSection: Int) -> CGFloat
    델리게이트에게 특정 섹션의 헤더 추정 높이를 요청합니다.
  • func tableView(UITableView, estimatedHeightForFooterInSection: Int) -> CGFloat
    델리게이트에게 특정 섹션의 푸터 예상 높이를 요청합니다.

Managing Accessory Views

  • func tableView(UITableView, accessoryButtonTappedForRowWith: IndexPath)
    사용자가 지정된 행의 세부 사항(디테일, 악세서리) 버튼을 눌렀음을 델리게이트에게 알립니다.

Managing Context Menus

  • Adding Context Menus in Your App
    iOS 앱에 컨텍스트 메뉴를 추가하여 유용한 작업에 빠르게 액세스할 수 있습니다.
  • func tableView(UITableView, contextMenuConfigurationForRowAt: IndexPath, point: CGPoint) -> UIContextMenuConfiguration?
    특정 지점의 행에 대한 컨텍스트 메뉴 구성을 반환합니다.
  • func tableView(UITableView, previewForDismissingContextMenuWithConfiguration: UIContextMenuConfiguration) -> UITargetedPreview?
    컨텍스트 메뉴를 해제할 때 데스티네이션 뷰를 반환합니다.
  • func tableView(UITableView, previewForHighlightingContextMenuWithConfiguration: UIContextMenuConfiguration) -> UITargetedPreview?
    생성된 기본 테이블뷰를 재정의하기 위해 뷰를 반환합니다.
  • func tableView(UITableView, willDisplayContextMenu: UIContextMenuConfiguration, animator: UIContextMenuInteractionAnimating?)
    델리게이트에게 컨텍스트 메뉴가 나타날 것임을 알립니다.
  • func tableView(UITableView, willEndContextMenuInteraction: UIContextMenuConfiguration, animator: UIContextMenuInteractionAnimating?)
    델리게이트에게 컨텍스트 메뉴가 사라질 것임을 알립니다.
  • func tableView(UITableView, willPerformPreviewActionForMenuWith: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating)
    사용자가 미리보기를 탭해서 커밋을 트리거할때 델리게이트에게 알립니다.

Responding to Row Actions

  • func tableView(UITableView, leadingSwipeActionsConfigurationForRowAt: IndexPath) -> UISwipeActionsConfiguration?
    행의 앞쪽 가장자리에 표시할 스와이프 동작을 반환합니다.
  • func tableView(UITableView, trailingSwipeActionsConfigurationForRowAt: IndexPath) -> UISwipeActionsConfiguration?
    행의 뒤쪽 가장자리에 표시할 스와이프 동작을 반환합니다.

Managing Table View Highlights

func tableView(UITableView, shouldHighlightRowAt: IndexPath) -> Bool
Asks the delegate if the specified row should be highlighted.
func tableView(UITableView, didHighlightRowAt: IndexPath)
Tells the delegate that the specified row was highlighted.
func tableView(UITableView, didUnhighlightRowAt: IndexPath)
Tells the delegate that the highlight was removed from the row at the specified index path.

Editing Table Rows
func tableView(UITableView, willBeginEditingRowAt: IndexPath)
Tells the delegate that the table view is about to go into editing mode.
func tableView(UITableView, didEndEditingRowAt: IndexPath?)
Tells the delegate that the table view has left editing mode.
func tableView(UITableView, editingStyleForRowAt: IndexPath) -> UITableViewCell.EditingStyle
Asks the delegate for the editing style of a row at a particular location in a table view.
func tableView(UITableView, titleForDeleteConfirmationButtonForRowAt: IndexPath) -> String?
Changes the default title of the delete-confirmation button.
func tableView(UITableView, shouldIndentWhileEditingRowAt: IndexPath) -> Bool
Asks the delegate whether the background of the specified row should be indented while the table view is in editing mode.
Reordering Table Rows
func tableView(UITableView, targetIndexPathForMoveFromRowAt: IndexPath, toProposedIndexPath: IndexPath) -> IndexPath
Asks the delegate to return a new index path to retarget a proposed move of a row.
Tracking the Removal of Views
func tableView(UITableView, didEndDisplaying: UITableViewCell, forRowAt: IndexPath)
Tells the delegate that the specified cell was removed from the table.
func tableView(UITableView, didEndDisplayingHeaderView: UIView, forSection: Int)
Tells the delegate that the specified header view was removed from the table.
func tableView(UITableView, didEndDisplayingFooterView: UIView, forSection: Int)
Tells the delegate that the specified footer view was removed from the table.
Managing Table View Focus
func tableView(UITableView, canFocusRowAt: IndexPath) -> Bool
Asks the delegate whether the cell at the specified index path is itself focusable.
func tableView(UITableView, shouldUpdateFocusIn: UITableViewFocusUpdateContext) -> Bool
Asks the delegate whether the focus update specified by the context is allowed to occur.
func tableView(UITableView, didUpdateFocusIn: UITableViewFocusUpdateContext, with: UIFocusAnimationCoordinator)
Tells the delegate that a focus update specified by the context has just occurred.
func indexPathForPreferredFocusedView(in: UITableView) -> IndexPath?
Asks the delegate for the table view’s index path for the preferred focused view.
Instance Methods
func tableView(UITableView, selectionFollowsFocusForRowAt: IndexPath) -> Bool
Asks the delegate whether to relate selection and focus behavior for the row at the corresponding index path.
Beta

profile
iOS dev / Japanese with Computer Science

0개의 댓글