Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- @IBOutlet weak var nameLabel: UILabel!
- @IBOutlet weak var surnameLabel: UILabel!
- @IBOutlet weak var topBar: UINavigationBar!
- @IBOutlet weak var backButtonItem: UIBarButtonItem!
- @IBOutlet weak var userTableView: UITableView!
- @IBOutlet weak var profilePic: UIImageView!
- let CellName = "Menu"
- let mainColor = UIColor(hex: 0xC4ABAA)
- var sections = ["Main Menu", "Settings", "Profile"]
- override func viewDidLoad() {
- super.viewDidLoad()
- userTableView.delegate = self
- userTableView.dataSource = self
- nameLabel.text = Helper.name
- surnameLabel.text = Helper.surname
- topBar.tintColor = .black
- topBar.barTintColor = mainColor
- topBar.titleTextAttributes = [
- NSAttributedString.Key.font: UIFont(name: "HelveticaNeue-Light", size: 22)!,
- NSAttributedString.Key.foregroundColor: UIColor.black
- ]
- userTableView.backgroundColor = mainColor
- view.backgroundColor = mainColor
- }
- // MARK: - Managing the Status Bar
- override var preferredStatusBarStyle: UIStatusBarStyle {
- return .lightContent
- }
- // MARK: - UITableView DataSource Methods
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return sections.count
- }
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = UITableViewCell()
- cell.textLabel?.text = sections[indexPath.row]
- cell.contentView.backgroundColor = mainColor
- return cell
- }
- // MARK: - UITableView Delegate Methods
- func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- print("Select row at")
- }
- @IBAction func profileButton(_ sender: Any) {
- performSegue(withIdentifier: "toProfile", sender: nil)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement