VesselWheel

UITableViewCell 본문

Xcode Study

UITableViewCell

JasonYang 2023. 11. 24. 11:33
Cell
 
Class

UITableViewCell

The visual representation of a single row in a table view.
iOS 2.0+ Mac Catalyst 13.1+ tvOS 9.0+ visionOS 1.0+ Beta
@MainActor
class UITableViewCell : UIView

Overview

A UITableViewCell object is a specialized type of view that manages the content of a single table row. You use cells primarily to organize and present your app’s custom content, but UITableViewCell provides some specific customizations to support table-related behaviors, including:

  • Applying a selection or highlight color to the cell
  • Adding standard accessory views, such as a detail or disclosure control
  • Putting the cell into an editable state
  • Indenting the cell’s content to create a visual hierarchy in your table

Your app’s content occupies most of the cell’s bounds, but the cell may adjust that space to make room for other content. Cells display accessory views on the trailing edge of their content area. When you put your table into edit mode, the cell adds a delete control to the leading edge of its content area, and optionally swaps out an accessory view for a reorder control. 

Every table view must have at least one type of cell for displaying content, and tables may have multiple cell types to display different types of content. Your table’s data source object handles the creation and configuration of cells immediately before they appear onscreen. For information about how to create your table’s cells, see Filling a table with data.

Configure your cell’s content

Configure the content and layout of your cells in your storyboard file. Tables have one cell type by default, but you can add more by changing the value in the table’s Prototype Cells attribute. In addition to configuring the cell’s content, make sure you configure the following attributes:

  • Identifier. Use this identifier (also known as a reuse identifier) to create the cell. 
  • Style. Choose one of the standard types or define a custom cell.
  • Class. Specify a UITableViewCell subclass with your custom behavior.

To configure the content and appearance of your cell, you can set its contentConfiguration and backgroundConfiguration.

'Xcode Study' 카테고리의 다른 글

Calculator in playground  (0) 2023.11.30
Xcode의 StoryBoard가 xml 화면으로 나올 때  (0) 2023.11.24
고차함수(Map, filter, reduce)  (1) 2023.11.21
sqlite3 설치 및 데이터 생성  (0) 2023.10.26
서버 구축 vapor  (0) 2023.10.26