|
@@ -12,21 +12,22 @@ class ContactCell: UITableViewCell {
|
|
//Klasse initialisieren nachschauen
|
|
//Klasse initialisieren nachschauen
|
|
let initialsLabel:UILabel = UILabel()
|
|
let initialsLabel:UILabel = UILabel()
|
|
let nameLabel = UILabel()
|
|
let nameLabel = UILabel()
|
|
|
|
+ let emailLabel = UILabel()
|
|
|
|
|
|
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
|
|
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
|
|
//Init von der Superklasse aufrufen nachschauen
|
|
//Init von der Superklasse aufrufen nachschauen
|
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
|
//configure and layout initialsLabel
|
|
//configure and layout initialsLabel
|
|
- let labelSize:CGFloat = 60
|
|
|
|
- let cornerRadius = labelSize/2
|
|
|
|
|
|
+ let initialsLabelSize:CGFloat = 60
|
|
|
|
+ let initialsLabelCornerRadius = initialsLabelSize/2
|
|
let margin:CGFloat = 15
|
|
let margin:CGFloat = 15
|
|
initialsLabel.textAlignment = NSTextAlignment.center
|
|
initialsLabel.textAlignment = NSTextAlignment.center
|
|
initialsLabel.translatesAutoresizingMaskIntoConstraints = false
|
|
initialsLabel.translatesAutoresizingMaskIntoConstraints = false
|
|
- initialsLabel.widthAnchor.constraint(equalToConstant: labelSize).isActive = true
|
|
|
|
- initialsLabel.heightAnchor.constraint(equalToConstant: labelSize).isActive = true
|
|
|
|
|
|
+ initialsLabel.widthAnchor.constraint(equalToConstant: initialsLabelSize).isActive = true
|
|
|
|
+ initialsLabel.heightAnchor.constraint(equalToConstant: initialsLabelSize).isActive = true
|
|
initialsLabel.backgroundColor = UIColor.green
|
|
initialsLabel.backgroundColor = UIColor.green
|
|
|
|
|
|
- initialsLabel.layer.cornerRadius = cornerRadius
|
|
|
|
|
|
+ initialsLabel.layer.cornerRadius = initialsLabelCornerRadius
|
|
initialsLabel.clipsToBounds = true
|
|
initialsLabel.clipsToBounds = true
|
|
|
|
|
|
self.contentView.addSubview(initialsLabel)
|
|
self.contentView.addSubview(initialsLabel)
|
|
@@ -34,13 +35,37 @@ class ContactCell: UITableViewCell {
|
|
initialsLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: margin).isActive = true
|
|
initialsLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: margin).isActive = true
|
|
initialsLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -margin).isActive = true
|
|
initialsLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -margin).isActive = true
|
|
|
|
|
|
|
|
+ let myStackView = UIStackView()
|
|
|
|
+ myStackView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ self.contentView.addSubview(myStackView)
|
|
|
|
+ myStackView.leadingAnchor.constraint(equalTo: initialsLabel.trailingAnchor, constant: margin).isActive = true
|
|
|
|
+ myStackView.centerYAnchor.constraint(equalTo: initialsLabel.centerYAnchor).isActive = true
|
|
|
|
+ myStackView.axis = .vertical
|
|
|
|
+ myStackView.addArrangedSubview(nameLabel)
|
|
|
|
+ myStackView.addArrangedSubview(emailLabel)
|
|
|
|
+
|
|
|
|
+ emailLabel.font = UIFont.systemFont(ofSize: 14)
|
|
|
|
+ emailLabel.textColor = UIColor.gray
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
//configure and layout nameLabel
|
|
//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
|
|
|
|
|
|
+ //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
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
func setColor(_ color: UIColor) {
|
|
func setColor(_ color: UIColor) {
|
|
self.initialsLabel.backgroundColor = color
|
|
self.initialsLabel.backgroundColor = color
|
|
}
|
|
}
|