UITableView 以列表形式呈現資料,UITableViewCell 則負責單行內容。理解 reuse、style、delegate 與自定義,是 iOS 列表開發的基礎。



在 ViewController 中加入 UITableView,設定 dataSource 與 delegate,並於 cellForRowAtIndexPath 使用 dequeueReusableCellWithIdentifier 重用 Cell。

可為 Cell 設定 imageView、detailTextLabel,並切換 UITableViewCellStyleDefault、Subtitle、Value1、Value2 等樣式。





可設定縮進、字體、行高、選取提示與自定義附件。若需要動態高度,可依內容計算或採用第三方佈局庫。


