do not reloadConversationsTableView when receive new message, instead updateUIButAvatar in ConversationCell

This commit is contained in:
nixzhu
2015-11-11 16:34:38 +08:00
parent e5e73d5108
commit db6edf399e
2 changed files with 8 additions and 8 deletions
@@ -80,7 +80,7 @@ class ConversationsViewController: UIViewController {
realm = try! Realm()
NSNotificationCenter.defaultCenter().addObserver(self, selector: "reloadConversationsTableView", name: YepConfig.Notification.newMessages, object: nil)
//NSNotificationCenter.defaultCenter().addObserver(self, selector: "reloadConversationsTableView", name: YepConfig.Notification.newMessages, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "reloadConversationsTableView", name: YepConfig.Notification.changedConversation, object: nil)
@@ -36,7 +36,7 @@ class ConversationCell: UITableViewCell {
deinit {
//NSNotificationCenter.defaultCenter().removeObserver(self)
NSNotificationCenter.defaultCenter().removeObserver(self)
}
override func awakeFromNib() {
@@ -45,7 +45,7 @@ class ConversationCell: UITableViewCell {
avatarImageView.contentMode = .ScaleAspectFill
avatarImageViewWidthConstraint.constant = YepConfig.ConversationCell.avatarSize
//NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateUIButAvatar:", name: YepConfig.Notification.newMessages, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateUIButAvatar:", name: YepConfig.Notification.newMessages, object: nil)
}
override func setSelected(selected: Bool, animated: Bool) {
@@ -54,11 +54,11 @@ class ConversationCell: UITableViewCell {
// Configure the view for the selected state
}
// func updateUIButAvatar(sender: NSNotification) {
//
// updateCountOfUnreadMessages()
// updateInfoLabels()
// }
func updateUIButAvatar(sender: NSNotification) {
updateCountOfUnreadMessages()
updateInfoLabels()
}
private func updateCountOfUnreadMessages() {