我正在使用 xmpp 开发聊天应用程序。我可以发送和接收消息。我的联系人在此处的 TableView 中我的问题是当有来自在线用户的消息时我想在我的 TableView 中的在线用户行显示消息符号。当那个行被选中消息符号将消失。
我尝试了使用标签的休闲方式,但没有实现
-(UITableViewCell*)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier=@"cell";
UITableViewCell *cell=[tableView1 dequeueReusableCellWithIdentifier:cellIdentifier];
if(cell==nil)
{
cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
XMPPUserCoreDataStorageObject *user1= [[self fetchedResultsController] objectAtIndexPath:indexPath];
cell.textLabel.text = user1.displayName;
UILabel *lblText = [[UILabel alloc] initWithFrame:CGRectMake(290,16,10,20)];
lblText.textColor = [UIColor orangeColor];
[cell addSubview:lblText];
if([cell.textLabel.text isEqualToString:user1.jidStr])
{
lblText.text=@"g";
}
}
谁能帮帮我。
提前致谢
最佳答案
传入消息存储在字典或数组中,然后重新加载 tableview 以显示最新到达的消息。
每次检索消息时都必须重新加载 TableView 。
关于iphone - 我如何在 iPhone 的 tableview 中的特定行显示传入消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11517350/