#77 Table View Controller 練習

製作上半部只能左右捲動,下半部上下捲動時、上半部不會跟著捲動的表格

練習內容:

1.設定表格的背景圖片(配合Container Veiw),參考:彼得教學文

2.表格 Table View Controller

3.上方 Scroll View

1.設定表格的背景圖片(不寫程式)

  • View Controller 加入背景 image

image 的 alpha 調至0.4

  • 將 Container View 拖曳到 Controller 的畫面上
  • 將 Container View 原本連到的空白的 View Controller 刪除,並將 Container View 拉大

( Container View 為表格捲動的範圍,上方預留要放 Scroll View 的空間)

  • 加入 Table View Controller,從 Container View 拉 Segue 至 Table View Controller,選擇 Embed
  • 將 Table View & Table View Cell 的 Background 設為 Clear Color

才不會遮住背景圖片

2.製作表格內容

幾個要注意的地方記錄:

  • 使 Cell 點擊後不變色

或是使 Table View 不能點選

  • 在 Table View 設定幾個 Section,在 Table View Section 設定 Section 名稱、有幾個 Cell

3.Scroll View

要注意:

  • 設定 Scroll View 的 Content Size
  • 讓 Scroll View 以“頁”為單位捲動

--

--