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