UPDATE 2015/12/24: Updated for Xcode 7.2 and Swift 2
UITableViewCell的---accessoryType属性
设置accessoryType属性
//没有任何样式
cell.accessoryType = UITableViewCellAccessoryType.None
//一个小箭头(这是APP上常见的形式)
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
//一个Info图标
cell.accessoryType = UITableViewCellAccessoryType.DetailButton
//一个Info图标+一个小箭头
cell.accessoryType = UITableViewCellAccessoryType.DetailDisclosureButton;
//一个对勾
cell.accessoryType = UITableViewCellAccessoryType.Checkmark
代码示例:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell:UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier:"mycell");
cell.textLabel!.text = dataScoureArr[indexPath.row]
cell.textLabel?.backgroundColor = UIColor.lightGrayColor()
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
return cell
}