5
cell!.textLabel?.text = vehicle["vrn"].string
cell?.detailTextLabel?.text = stateString

我想显示stateStringbold并且也尝试使用textLabeldetailedText但它没有用。

4

3 回答 3

5

detailTextLabel您可以设置类似这样的字体属性:

cell.detailTextLabel?.font = UIFont.boldSystemFontOfSize(15.0)
于 2015-07-30T13:59:21.937 回答
5

您可以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

我希望这对你有帮助。

于 2015-07-30T15:27:41.600 回答
0

如果您想使用故事板加粗文本标签,只需在属性检查器中选择阴影颜色以与该文本颜色相同。它对我有用,试试吧....

于 2016-10-03T07:36:27.587 回答