Reputation: 197
I have two attributed strings and I want to place them in one label, how would I do this?
let font = UIFont(name: "Hidden", size: 15)
let addfont = UIFont(name: "Hidden", size: 15)
var att = [NSFontAttributeName : font]
let attrString = NSAttributedString(
string: animalname[indexPath.row],
attributes: NSDictionary(
object: font!,
forKey: NSFontAttributeName) as! [String : AnyObject])
let attrStringAdd = NSAttributedString(
string: animalloc[indexPath.row],
attributes: NSDictionary(
object: addfont!,
forKey: NSFontAttributeName) as! [String : AnyObject])
cell.animaltext.attributedText = attrString + attrStringAdd
Upvotes: 0
Views: 2010
Reputation: 150
Upvotes: 1