Ass*_*bin 15 uitableview checkmark swift
这是我的代码:
cell.accessoryType = UITableViewCellAccessoryType.Checkmark
Run Code Online (Sandbox Code Playgroud)
但是当我运行应用程序时,我看不到复选标记.
然后我将背景颜色设置为黑色,我可以看到一个白色的复选标记.
如何将复选标记的颜色更改为蓝色等其他颜色?
Ash*_*kad 33
是的,你可以做到.
只需设置tintColor
单元格即可.
cell.tintColor = UIColor.whiteColor()
cell.accessoryType = UITableViewCellAccessoryType.Checkmark
Run Code Online (Sandbox Code Playgroud)
斯威夫特3
let aCell = tableView.dequeueReusableCell(withIdentifier: "Cell")!
aCell.tintColor = UIColor.red
aCell.accessoryType = .checkmark
return aCell
Run Code Online (Sandbox Code Playgroud)
您也可以从Attributes Inspector中执行此操作
只需从Attribute Inspector中设置UITableViewCell的色调颜色,或者通过如下编码设置
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cellIdentifier = "SimpleTableViewCell"
let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath)
// just add below lines
cell.accessoryType = UITableViewCellAccessoryType.checkmark
cell.tintColor = UIColor.red
return cell
}
Run Code Online (Sandbox Code Playgroud)
@HenriqueGüttlerMorbin检查这希望它会对你有用.
归档时间: |
|
查看次数: |
10480 次 |
最近记录: |