Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. import UIKit
  2.  
  3. @IBOutlet weak var nameLabel: UILabel!
  4. @IBOutlet weak var surnameLabel: UILabel!
  5. @IBOutlet weak var topBar: UINavigationBar!
  6. @IBOutlet weak var backButtonItem: UIBarButtonItem!
  7. @IBOutlet weak var userTableView: UITableView!
  8. @IBOutlet weak var profilePic: UIImageView!
  9. let CellName = "Menu"
  10. let mainColor = UIColor(hex: 0xC4ABAA)
  11. var sections = ["Main Menu", "Settings", "Profile"]
  12. override func viewDidLoad() {
  13. super.viewDidLoad()
  14. userTableView.delegate = self
  15. userTableView.dataSource = self
  16. nameLabel.text = Helper.name
  17. surnameLabel.text = Helper.surname
  18.  
  19. topBar.tintColor = .black
  20. topBar.barTintColor = mainColor
  21. topBar.titleTextAttributes = [
  22. NSAttributedString.Key.font: UIFont(name: "HelveticaNeue-Light", size: 22)!,
  23. NSAttributedString.Key.foregroundColor: UIColor.black
  24. ]
  25. userTableView.backgroundColor = mainColor
  26. view.backgroundColor = mainColor
  27. }
  28.  
  29.  
  30.  
  31. // MARK: - Managing the Status Bar
  32.  
  33. override var preferredStatusBarStyle: UIStatusBarStyle {
  34. return .lightContent
  35. }
  36.  
  37. // MARK: - UITableView DataSource Methods
  38.  
  39. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  40. return sections.count
  41. }
  42.  
  43.  
  44. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  45. let cell = UITableViewCell()
  46. cell.textLabel?.text = sections[indexPath.row]
  47. cell.contentView.backgroundColor = mainColor
  48. return cell
  49. }
  50.  
  51. // MARK: - UITableView Delegate Methods
  52.  
  53. func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  54. print("Select row at")
  55. }
  56. @IBAction func profileButton(_ sender: Any) {
  57. performSegue(withIdentifier: "toProfile", sender: nil)
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement