【发布时间】:2015-11-04 10:16:08
【问题描述】:
当我收到一条消息时,我会将用户名和未读消息的计数写入 CoreData。并借助此功能:
func unreadMessagesCountBadge(cell: onlineUserCell, forCount count: Int)
我将我的徽章添加到单元格中。
但问题是,我不知道如何将此徽章添加到确切的用户。当我收到消息时,我会在日志中看到:
data: {
count = 15;
username = "my_user@domain.com";
}
那么,我怎样才能将我的徽章添加到确切的单元格?在我的手机上,我只有用户名和姓氏,而不是用户名。
当我尝试时:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> onlineUserCell {
let cell:onlineUserCell = self.tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! onlineUserCell
unreadMessagesCountBadge(cell, forCount: badgeValue)
}
但它会将我的徽章添加到所有用户,而不是确切的用户。知道我该如何解决它?
【问题讨论】:
标签: ios swift uitableview core-data badge