Ecco il testo:parte in grassetto del stringa nel UITextView rapida
@IBOutlet weak var legalText: UITextView!
let textToAppend = "TERMS OF SERVICE\nLast Updated: May 7, 2015\n\nPLEASE NOTE: The HIGO Terms of Service as stated below is effective as of the 'Last Updated' date above for any user who is browsing the HIGO website, or for any user who creates a HIGO account on or after that date."
legalText.text = legalText.text.stringByAppendingString(textToAppend)
voglio bold "Termini di servizio" e "NOTA: I Higo Termini di servizio come indicato qui di seguito è valido a partire dalla ' Data ultimo aggiornamento 'precedente per qualsiasi utente che sta navigando nel sito Web HIGO o per qualsiasi utente che crea un account HIGO in data successiva o successiva. "
provo con l'utilizzo di codice in UILabel UITextView, ma non ha funzionato:
var termsofservice : UILabel = UILabel()
termsofservice.numberOfLines = 0
termsofservice.text = "TERMS OF SERVICE"
termsofservice.font = UIFont.boldSystemFontOfSize(20)
termsofservice.textAlignment = NSTextAlignment.Left;
var pleasenote : UILabel = UILabel()
pleasenote.numberOfLines = 0
pleasenote.text = "PLEASE NOTE: The HIGO Terms of Service as stated below is effective as of the 'Last Updated' date above for any user who is browsing the HIGO website, or for any user who creates a HIGO account on or after that date."
pleasenote.font = UIFont.boldSystemFontOfSize(20)
pleasenote.textAlignment = NSTextAlignment.Left;
let textToAppend = "\(termsofservice)\nLast Updated: May 7, 2015\n\n\(pleasenote)"
anche provare con questi, ma non ha funzionato, ma solo mostrare "Termini di servizio" e "ultimo aggiornamento ..", ha fatto non mostrare "PER FAVORE NOTA ..."
var termsofservice = "TERMS OF SERVICE"
var normalText = "\n\nLast Updated: May 7, 2015"
var pleasenote = "\n\nPLEASE NOTE: The HIGO Terms of Service as stated below is effective as of the 'Last Updated' date above for any user who is browsing the HIGO website, or for any user who creates a HIGO account on or after that date."
var attributedString = NSMutableAttributedString(string:normalText)
var attrs = [NSFontAttributeName : UIFont.boldSystemFontOfSize(15)]
var boldString = NSMutableAttributedString(string:pleasenote, attributes:attrs)
var boldString0 = NSMutableAttributedString(string:termsofservice, attributes:attrs)
boldString0.appendAttributedString(attributedString)
attributedString.appendAttributedString(boldString)
legalText.attributedText = boldString0
Come evidenziare quella parte di stringa?
Nota: il testo è ancora lungo e contiene più parti di stringa in grassetto.
si dovrebbe usare attribuito stringa – Miknash
possibile duplicato [Rendere il testo in grassetto usando la stringa attribuita in swift] (http://stackoverflow.com/questions/28496093/making-text-bold-using-attributed-string-in-swift) – Larme
come? Per favore mi mostri. – Sarimin