Ios 设置表视图时是否需要将单元格出列';你的手机风格是什么?

Ios 设置表视图时是否需要将单元格出列';你的手机风格是什么?,ios,swift,uitableview,Ios,Swift,Uitableview,我正在尝试将表视图单元格的样式更改为主视图控制器中的subtitle(基于给定的模板代码),因此我删除了 let cell=tableView.dequeueReusableCell(带有标识符:“cell”,for:indexath)并添加了: let cell = UITableViewCell(style: UITableViewCell.CellStyle.subtitle, reuseIdentifier: "Cell") 这是完整的cellForRowAt:code。它是有效的——

我正在尝试将表视图单元格的样式更改为主视图控制器中的
subtitle
(基于给定的模板代码),因此我删除了
let cell=tableView.dequeueReusableCell(带有标识符:“cell”,for:indexath)
并添加了:

let cell = UITableViewCell(style: UITableViewCell.CellStyle.subtitle, reuseIdentifier: "Cell")
这是完整的
cellForRowAt:
code。它是有效的——但我只有三行内容,如果这有区别的话。不过,如果我突然有数百个条目,这可能会停止工作

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

        let cell = UITableViewCell(style: UITableViewCell.CellStyle.subtitle, reuseIdentifier: "Cell")
        cell.textLabel!.text = myBookStore.bookList[indexPath.row].title
        cell.detailTextLabel!.text = "Default subtitle"
        return cell
    }
我应该调用这个dequeueReusableCell(带标识符:for:)方法吗?

不要这样做

始终使用
dequeueReusableCell(with identifier:for:)
方法,并更改情节提要(Interface Builder)中单元格的样式


如果您需要同时具有
basic
subtitle
样式的单元格,请在Interface Builder中创建第二个单元格

谢谢@vadian。是否可以更改代码中单元格的样式并调用dequeueReusableCell(with Identifier:for:)?否,这不是因为在单元格出列后代码中无法设置样式。