0

各セルにカスタム ラベル (タイム スタンプ付き) を追加し、JSQMessageViewController に画像 (警告メッセージ用) を追加したいと考えています。私はすでに toplabel と同様に bottomlabel を使用しています。しかし、私は望む結果を得ることができません。 画像は、私がそれをどのように見せたいかの参考です

参考画像

4

3 に答える 3

0
UIImage *bubbleImage = [UIImage imageNamed:@"Commentbox_right.png"];
        UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(textFrame.origin.x-2, textFrame.origin.y-2, textFrame.size.width+4 , textFrame.size.height+7)];
        imgView.image= [bubbleImage stretchableImageWithLeftCapWidth:bubbleImage.size.width/2-5 topCapHeight:bubbleImage.size.height/2];
        [cell addSubview:imgView];
        [cell bringSubviewToFront:txtViewMessage];

        UILabel *lblTimeStamp = [[UILabel alloc]initWithFrame:CGRectMake(textFrame.origin.x+2, imgView.frame.size.height+imgView.frame.origin.y, 90, 10)];
        [lblTimeStamp setText:message.dateTime];//set time here
        [lblTimeStamp setFont:FONT_300_LIGHT(7)];
        [lblTimeStamp setTextColor:GET_COLOR_WITH_RGB(129,129,129, 1)];
        [lblTimeStamp setTextAlignment:NSTextAlignmentLeft];
        [lblTimeStamp setBackgroundColor:[UIColor  clearColor]];
        [cell addSubview:lblTimeStamp];
于 2015-10-13T08:56:58.967 に答える
0

申し訳ありませんが、調べる時間があまりありませんでした..しかし、同じメッセージバブルxibにその画像を追加し、必要に応じて制約を追加できます。このxibを試してください

于 2015-10-27T08:40:08.460 に答える