瀏覽代碼

show selected background color with high transparency

cyberta 3 年之前
父節點
當前提交
661b202631
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      deltachat-ios/Chat/Views/Cells/BaseMessageCell.swift

+ 9 - 0
deltachat-ios/Chat/Views/Cells/BaseMessageCell.swift

@@ -273,6 +273,15 @@ public class BaseMessageCell: UITableViewCell {
         }
     }
 
+    public override func setSelected(_ selected: Bool, animated: Bool) {
+         super.setSelected(selected, animated: animated)
+         if selected {
+             selectedBackgroundView?.backgroundColor = DcColors.chatBackgroundColor.withAlphaComponent(0.25)
+         } else {
+             selectedBackgroundView?.backgroundColor = .clear
+         }
+     }
+
     // update classes inheriting BaseMessageCell first before calling super.update(...)
     func update(dcContext: DcContext, msg: DcMsg, messageStyle: UIRectCorner, showAvatar: Bool, showName: Bool, searchText: String?, highlight: Bool) {
         let fromContact = dcContext.getContact(id: msg.fromContactId)