1
J'essaie de souligner une chaîne avec une chaîne NSAttributed. Pour une raison quelconque, mes lignes font l'exception:La définition de NSUnderlineStyle provoque une exception de sélecteur non reconnue
-[_SwiftValue _getValue:forType:]: unrecognized selector sent to instance
Le résultat est censé être utilisé pour un UILabel dans un UITableView et est créé au besoin.
Voici le code:
attributedString = NSMutableAttributedString(string: message)
if let actor = event.actor {
let attributes = [NSUnderlineStyleAttributeName:NSUnderlineStyle.styleSingle]
var attributedActorString = NSMutableAttributedString(string: actor.shirtName, attributes: attributes)
attributedActorString.insert(NSAttributedString(string: " "), at: 0)
attributedActorString.append(NSAttributedString(string: ". ")) attributedActorString.append(attributedImageStringForUrl(event.actor!.portraitImageUrl, indexPath: indexPath))
attributedString.append(attributedActorString)
}
qui a fait l'affaire pour moi! Je vous remercie. – ff10
@ ff10, vous êtes les bienvenus;] –