func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell:UITableViewCell = UITableViewCell(style:UITableViewCell.CellStyle.subtitle, reuseIdentifier: nil)
cell.textLabel!.text = "Cell te1xt"
cell.detailTextLabel?.text = "Cell Subtitle1"
cell.imageView!.image = UIImage(named:"image1.png")
return cell
}
UITableViewCell样式有四种:
1. UITableViewCell.CellStyle.Default
(Default样式:左边一个显示图片的imageView,一个标题textLabel,没有detailTextLabel)
2. UITableViewCell.CellStyle.subtitle
(Subtitle样式:左边一个显示图片的imageView,上边一个主标题textLabel,一个副标题detailTextLabel。主标题字体大且加黑,副标题字体小在主标题下边。)
3. UITableViewCell.CellStyle.value1
(Value1样式:左边一个显示图片的imageView,左边一个主标题textLabel,右边一个副标题detailTextLabel,主标题字体比较黑)
4. UITableViewCell.CellStyle.value2
(Value2样式:左边一个主标题textLabel字体偏小,挨着右边一个副标题detailTextLabel,字体大且加黑。)