2016-11-26 60 views
0

爲什麼下面的代碼只顯示1到17的單元格?indexPath.row從0到16而不是在

internal func tableView(_ tableView: UITableView,numberOfRowsInSection section: Int) -> Int { 

    return 20 
} 

internal func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 

    let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier:"Cell") 


    cell.textLabel?.text=String(indexPath.row+1) 
     print(indexPath.row) 
    return cell 
}` 

輸出: enter image description here

+0

嚇人。清理,刪除派生數據並重試。 – shallowThought

回答

0

請啓用您的tableview的滾動,並且在輸出向下滾動細胞。

相關問題