1
我正在尝试将字幕添加到表格视图中的单元格。我正在尝试此代码,但字幕未显示。使用swift自定义TableViewCell
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell=tableView.dequeueReusableCellWithIdentifier("topCell", forIndexPath: indexPath) as UITableViewCell
cell.textLabel?.text=listPerson[indexPath.row].name
cell.detailTextLabel?.text="test"
var personImage=UIImage(named: listPerson[indexPath.row].country)
cell.imageView?.image=personImage
return cell
}
我也想知道是否有可能在单元右侧添加另一个图像。
这应该是可能的。您需要确保故事板内的单元格具有标识符“topCell”才能正常工作。 – onemillion