1
私はiosでswift 3を使用しています。私のラベルには複数のスタイルがあります。コードは以下の通りです。completionDateをイタリックにします。そして、私はquanityをこの色e50079にしたい、そして私はdistが511b70になりたいと思っています。storeNameをイタリックにします。迅速な3を使って、どうすればいいですか? Aseiderにより示唆されるようにあなたがラベルテキストには複数のフォント、スタイル、色があります
var completionDate = menuItem.completionDate!+"\n"
var quantity = menuItem.quantity!+" "+menuItem.product!
var were = " were"
var dist = menuItem.distributionActivityType!
var storeName = menuItem.storeName!+"-"+menuItem.city!
cell.label1.text = completionDate+""+quantity+""+were+" "+dist+"\n"+storeName
「NSAttributedString」(https://developer.apple.com/reference/foundation/nsattributedstring)を使用する必要があります。属性付き文字列をラベルのattributedText-Propertyに割り当てます。 – Aseider
私はどのように私の最初のvarの長さを取得するのですか?文字列の場合は –
、yourString.characters.count –