From 553a1efdf31898b7e909bcfe70c27346eb41f4b5 Mon Sep 17 00:00:00 2001 From: Javier Heisekce Date: Tue, 24 Mar 2020 12:21:08 -0400 Subject: [PATCH] agrega estilo a los nombres en la tabla --- ContactsApp/ContactsViewController.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ContactsApp/ContactsViewController.swift b/ContactsApp/ContactsViewController.swift index 75944b8..dacdd22 100644 --- a/ContactsApp/ContactsViewController.swift +++ b/ContactsApp/ContactsViewController.swift @@ -85,8 +85,17 @@ extension ContactsViewController: UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "contactName")! let contactCell = contactStructArray[indexPath.section].contacts[indexPath.row] - - cell.textLabel?.text = "\(contactCell.givenName) \(contactCell.familyName)" + + let givenName = "\(contactCell.givenName) " + let familyName: NSMutableAttributedString = NSMutableAttributedString(string: contactCell.familyName) + + let attributes: [NSAttributedString.Key: Any] = [ + .font: UIFont.boldSystemFont(ofSize: 15) + ] + let fullName = NSMutableAttributedString(string: givenName, attributes: attributes) + fullName.append(familyName) + + cell.textLabel?.attributedText = fullName return cell } -- libgit2 0.26.0