私は 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";
}
}
誰でも私を助けることができます。
前もって感謝します