Browse Source

applying to NewChatViewController

nayooti 4 years ago
parent
commit
7161302d76
1 changed files with 3 additions and 11 deletions
  1. 3 11
      deltachat-ios/Controller/NewChatViewController.swift

+ 3 - 11
deltachat-ios/Controller/NewChatViewController.swift

@@ -84,7 +84,6 @@ class NewChatViewController: UITableViewController {
         }
         }
         tableView.register(ActionCell.self, forCellReuseIdentifier: "actionCell")
         tableView.register(ActionCell.self, forCellReuseIdentifier: "actionCell")
         tableView.register(ContactCell.self, forCellReuseIdentifier: "contactCell")
         tableView.register(ContactCell.self, forCellReuseIdentifier: "contactCell")
-        setupSubviews()
     }
     }
 
 
     override func viewWillAppear(_ animated: Bool) {
     override func viewWillAppear(_ animated: Bool) {
@@ -92,16 +91,6 @@ class NewChatViewController: UITableViewController {
         deviceContactAccessGranted = CNContactStore.authorizationStatus(for: .contacts) == .authorized
         deviceContactAccessGranted = CNContactStore.authorizationStatus(for: .contacts) == .authorized
     }
     }
 
 
-    // MARK: - setup
-    private func setupSubviews() {
-        view.addSubview(emptySearchStateLabel)
-        emptySearchStateLabel.translatesAutoresizingMaskIntoConstraints = false
-        emptySearchStateLabel.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor).isActive = true
-        emptySearchStateLabel.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 40).isActive = true
-        emptySearchStateLabel.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -40).isActive = true
-        emptySearchStateLabel.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor).isActive = true
-    }
-
     // MARK: - actions
     // MARK: - actions
     @objc func cancelButtonPressed() {
     @objc func cancelButtonPressed() {
         dismiss(animated: true, completion: nil)
         dismiss(animated: true, completion: nil)
@@ -295,9 +284,12 @@ class NewChatViewController: UITableViewController {
             )
             )
             emptySearchStateLabel.text = text
             emptySearchStateLabel.text = text
             emptySearchStateLabel.isHidden = false
             emptySearchStateLabel.isHidden = false
+            emptySearchStateLabel.frame = CGRect(x: 0, y: 0, width: 0, height: emptySearchStateLabel.intrinsicContentSize.height)
+            tableView.tableHeaderView = emptySearchStateLabel
         } else {
         } else {
             emptySearchStateLabel.text = nil
             emptySearchStateLabel.text = nil
             emptySearchStateLabel.isHidden = true
             emptySearchStateLabel.isHidden = true
+            tableView.tableHeaderView = nil
         }
         }
     }
     }