Commit 0331ebf1 authored by Steven杜宇's avatar Steven杜宇

// 未读消息

parent 1c1a0a85
...@@ -16,7 +16,12 @@ class YHMessageBellView: UIView { ...@@ -16,7 +16,12 @@ class YHMessageBellView: UIView {
var unreadCount:Int = 0 { var unreadCount:Int = 0 {
didSet { didSet {
self.unreadLabel.isHidden = (self.unreadCount <= 0) self.unreadLabel.isHidden = (self.unreadCount <= 0)
var width = 18.0 if 0 < self.unreadCount && self.unreadCount < 100 {
self.unreadLabel.text = "\(self.unreadCount)"
} else if self.unreadCount >= 100 {
self.unreadLabel.text = "99+"
}
var width = 16.0
if 10 <= self.unreadCount && self.unreadCount < 100 { if 10 <= self.unreadCount && self.unreadCount < 100 {
width = 22.0 width = 22.0
} else if self.unreadCount >= 100 { } else if self.unreadCount >= 100 {
...@@ -72,8 +77,8 @@ class YHMessageBellView: UIView { ...@@ -72,8 +77,8 @@ class YHMessageBellView: UIView {
self.unreadLabel.snp.makeConstraints { make in self.unreadLabel.snp.makeConstraints { make in
make.left.equalTo(self.bellImgV).offset(10) make.left.equalTo(self.bellImgV).offset(10)
make.bottom.equalTo(self.bellImgV.snp.top).offset(8.0) make.bottom.equalTo(self.bellImgV.snp.top).offset(8.0)
make.height.equalTo(18.0) make.height.equalTo(16.0)
make.width.equalTo(18.0) make.width.equalTo(16.0)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment