Raj*_*Raj 5 uitableview detailtextlabel swift
cell!.textLabel?.text = vehicle["vrn"].string
cell?.detailTextLabel?.text = stateString
Run Code Online (Sandbox Code Playgroud)
我想显示stateString
为,bold
并且还尝试使用textLabel
代替,detailedText
但是它没有用。
您可以这样设置font属性detailTextLabel
:
cell.detailTextLabel?.font = UIFont.boldSystemFontOfSize(15.0)
Run Code Online (Sandbox Code Playgroud)
您可以font
在UILabel
类中使用该属性。
// You need to set the name of your font here
cell.detailTextLabel?.font = UIFont(name:"HelveticaNeue-Bold", size: 16.0)
Run Code Online (Sandbox Code Playgroud)
还有其他使用该attributedText
属性的选项,但意味着需要更多代码,如下所示:
// Define attributes to set
let labelFont = UIFont(name: "HelveticaNeue-Bold", size: 16)
let attributes :Dictionary = [NSFontAttributeName : labelFont]
// Create the attributed string
var attrString = NSAttributedString(string: "textOfYourLabel", attributes:attributes)
cell.detailTextLabel?.attributedText = attrString
Run Code Online (Sandbox Code Playgroud)
希望对您有所帮助。
归档时间: |
|
查看次数: |
7395 次 |
最近记录: |