Project 01 - TableView ☝🏻

DaY·2021년 3월 16일
1

iOS

목록 보기
4/52
post-thumbnail

main.storyboard에 tableView를 설정하는 방법은 두 가지가 있다.

먼저, 빈 view controller에 Table View를 삽입하는 방법

또는 아예 Table View Controller를 삽입하는 방법이 있다.

이 둘의 차이는 custom의 편의 차이다.

view controller + table view
class에 UITableViewControllerDelegate, UITableViewControllerDataSource를 채택해야하며 tableview의 delegate, datasource가 자신(self)임을 지정해야 하지만 custom하기 편리하다.

tableViewController
이미 delegate, datasource가 이미 지정되어 있다. 하지만 custom하기 불편하다.

tableView의 Cell은 기본으로 제공되는 형태를 사용해도 되고, 새롭게 custom해도 된다.

  • 기본 제공 형태
    Table View Cell에서 Style을 보면 다음과 같이 나온다.

    Basic

    Right Detail

    Left Detail

    Subtitle

난 TableViewController에 Cell을 custom해 사용했다.

  • 원하는 크기만큼 Cell을 늘린 후 ui를 삽입한다.

0개의 댓글