cell!.textLabel?.text = vehicle["vrn"].string
cell?.detailTextLabel?.text = stateString
我想显示stateString
为bold
并且也尝试使用textLabel
,detailedText
但它没有用。
cell!.textLabel?.text = vehicle["vrn"].string
cell?.detailTextLabel?.text = stateString
我想显示stateString
为bold
并且也尝试使用textLabel
,detailedText
但它没有用。
detailTextLabel
您可以设置类似这样的字体属性:
cell.detailTextLabel?.font = UIFont.boldSystemFontOfSize(15.0)
您可以font
在类中使用该属性UILabel
。
// You need to set the name of your font here
cell.detailTextLabel?.font = UIFont(name:"HelveticaNeue-Bold", size: 16.0)
还有其他使用该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
我希望这对你有帮助。
如果您想使用故事板加粗文本标签,只需在属性检查器中选择阴影颜色以与该文本颜色相同。它对我有用,试试吧....