浏览代码

dark background color for contact cell in profile view

Alla Reinsch 7 年之前
父节点
当前提交
ccdecfe57f
共有 2 个文件被更改,包括 12 次插入17 次删除
  1. 11 17
      deltachat-ios/ContactCell.swift
  2. 1 0
      deltachat-ios/ContactProfileViewController.swift

+ 11 - 17
deltachat-ios/ContactCell.swift

@@ -13,6 +13,15 @@ class ContactCell: UITableViewCell {
     let initialsLabel:UILabel = UILabel()
     let initialsLabel:UILabel = UILabel()
     let nameLabel = UILabel()
     let nameLabel = UILabel()
     let emailLabel = UILabel()
     let emailLabel = UILabel()
+    var darkMode: Bool = false {
+        didSet {
+            if darkMode {
+                contentView.backgroundColor = UIColor.darkGray
+                nameLabel.textColor = UIColor.white
+                emailLabel.textColor = UIColor.white
+            }
+        }
+    }
     
     
     override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
     override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
         //Init von der Superklasse aufrufen nachschauen
         //Init von der Superklasse aufrufen nachschauen
@@ -22,6 +31,8 @@ class ContactCell: UITableViewCell {
         let initialsLabelCornerRadius = initialsLabelSize/2
         let initialsLabelCornerRadius = initialsLabelSize/2
         let margin:CGFloat = 15
         let margin:CGFloat = 15
         initialsLabel.textAlignment = NSTextAlignment.center
         initialsLabel.textAlignment = NSTextAlignment.center
+        initialsLabel.textColor = UIColor.white
+        initialsLabel.font = UIFont.systemFont(ofSize: 24)
         initialsLabel.translatesAutoresizingMaskIntoConstraints = false
         initialsLabel.translatesAutoresizingMaskIntoConstraints = false
         initialsLabel.widthAnchor.constraint(equalToConstant: initialsLabelSize).isActive = true
         initialsLabel.widthAnchor.constraint(equalToConstant: initialsLabelSize).isActive = true
         initialsLabel.heightAnchor.constraint(equalToConstant: initialsLabelSize).isActive = true
         initialsLabel.heightAnchor.constraint(equalToConstant: initialsLabelSize).isActive = true
@@ -46,23 +57,6 @@ class ContactCell: UITableViewCell {
         
         
         emailLabel.font = UIFont.systemFont(ofSize: 14)
         emailLabel.font = UIFont.systemFont(ofSize: 14)
         emailLabel.textColor = UIColor.gray
         emailLabel.textColor = UIColor.gray
-        
-        
-        
-
-        //configure and layout nameLabel
-        //nameLabel.translatesAutoresizingMaskIntoConstraints = false
-        //self.contentView.addSubview(nameLabel)
-        //nameLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -margin).isActive = true
-        //nameLabel.centerYAnchor.constraint(equalTo: initialsLabel.centerYAnchor).isActive = true
-    
-        //emailLabel.translatesAutoresizingMaskIntoConstraints = false
-        //self.contentView.addSubview(emailLabel)
-        //emailLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -margin).isActive = true
-        //emailLabel.centerYAnchor.constraint(equalTo: initialsLabel.centerYAnchor).isActive = true
-        
-        
-    
     }
     }
     
     
     
     

+ 1 - 0
deltachat-ios/ContactProfileViewController.swift

@@ -67,6 +67,7 @@ class ContactProfileViewController: UITableViewController {
             contactCell.emailLabel.text = email
             contactCell.emailLabel.text = email
             contactCell.initialsLabel.text = Utils.getInitials(inputName: name)
             contactCell.initialsLabel.text = Utils.getInitials(inputName: name)
             contactCell.setColor(self.contactColor)
             contactCell.setColor(self.contactColor)
+            contactCell.darkMode = true
             return contactCell
             return contactCell
         }
         }
         let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
         let cell = UITableViewCell(style: .default, reuseIdentifier: nil)