当我收到消息时,我将未读消息的用户名和计数写入CoreData。并在此功能的帮助下:如何检测哪个单元格添加徽章?
func unreadMessagesCountBadge(cell: onlineUserCell, forCount count: Int)
我添加到单元格我的徽章。
但问题是,我不知道如何将这个徽章添加到确切的用户。当我收到消息时,我在日志中看到:
data: {
count = 15;
username = "[email protected]";
}
那么,我该如何将我的徽章添加到确切单元格?在我的手机上,我只有用户的姓名,而不是用户名。
当我尝试:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> onlineUserCell {
let cell:onlineUserCell = self.tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! onlineUserCell
unreadMessagesCountBadge(cell, forCount: badgeValue)
}
但它增加了我的徽章给所有用户,而不是精确的用户。 Anyideas我该如何解决它?