我正在使用xmpp开发聊天应用程序。我可以发送和接收消息。我的联系人在表格视图中,我的问题是当有来自在线用户的消息时,我想在表格视图中的在线用户行显示消息符号。信息符号将消失。
我尝试了使用标签的休闲方式,但没有实现
-(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";
}
}
谁能帮我。
提前致谢
最佳答案
传入的消息存储在Dictionary或Array中,然后重新加载tableview以显示到达的最新消息。
您每次检索邮件时都必须重新加载表视图。
关于iphone - 我如何在iPhone的Tableview中的特定行显示传入消息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11517350/