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

stateStringasを表示したいのですが、代わりにbold使用しようとしましたが、うまくいきませんでした。textLabeldetailedText

4

3 に答える 3

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 に答える
5

detailTextLabel次のように font プロパティを設定できます。

cell.detailTextLabel?.font = UIFont.boldSystemFontOfSize(15.0)
于 2015-07-30T13:59:21.937 に答える
0

ストーリー ボードを使用してテキスト ラベルを太字にしたい場合は、属性インスペクターでSHADOW 色をそのテキスト色と同じ色に選択するだけです。私はそれを試してみてください....

于 2016-10-03T07:36:27.587 に答える