| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- //
- // replyInfoCell.m
- // IBOSS
- //
- // Created by guan hong hou on 15/11/16.
- // Copyright © 2015年 elongtian. All rights reserved.
- //
- #import "ReplyInfoCell.h"
- #import "ReplyFrame.h"
- #define kTextFont [UIFont systemFontOfSize:14]
- #define logContentTextFont [UIFont systemFontOfSize:14]
- @interface ReplyInfoCell(){
-
- }
- @end
- @implementation ReplyInfoCell
- #pragma mark -公有方法
- //初始化tableviewcell的样式
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- return self;
- }
- #pragma mark -私有方法
- //设置回复信息UI
- - (void)setReplyInfoData:(ReplyFrame*)replyFrame {
- _replyInfo= [replyFrame replyInfo];
- if([_replyInfo userName ]!=nil &&[_replyInfo userName].length>0){
- _replyUserNameLabel= [UIButton buttonWithType:UIButtonTypeCustom];
- _replyUserNameLabel.frame= [replyFrame replierF];
- _replyUserNameLabel.titleLabel.font =kTextFont;
- _replyUserNameLabel.backgroundColor = [UIColor clearColor];
- [_replyUserNameLabel setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- [_replyUserNameLabel setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
- NSString *replyUserName=[_replyInfo userName];
- NSString *userName=[NSString stringWithFormat:@"%@:",replyUserName];
- [_replyUserNameLabel setTitle:userName forState:UIControlStateNormal];
- [self.contentView addSubview: _replyUserNameLabel];
-
- [_replyUserNameLabel addTarget:self action:@selector(answerButtonDidClicked:) forControlEvents:UIControlEventTouchUpInside];
- if([_replyInfo RepliedUserName]!=nil &&[_replyInfo RepliedUserName].length>0){
- BOOL result = [[_replyInfo RepliedUserName] caseInsensitiveCompare:[_replyInfo userName]]== NSOrderedSame;
- if(!result){
- _replyAtUserNameLabel = [[UILabel alloc] initWithFrame:[replyFrame replierAtF]];
- _replyAtUserNameLabel.backgroundColor = [UIColor clearColor];
- _replyAtUserNameLabel.textColor = [UIColor colorWithRed:255.0/255.0 green:101.0/255.0 blue:38.0/255.0 alpha:1];
- _replyAtUserNameLabel.font =logContentTextFont;
- _replyAtUserNameLabel.textAlignment = NSTextAlignmentLeft;
- [self.contentView addSubview: _replyAtUserNameLabel];
- NSString *atUserName=[_replyInfo RepliedUserName];
- NSString *replierAtUserName=[NSString stringWithFormat:@"@%@",atUserName];
- _replyAtUserNameLabel.text=replierAtUserName;
- _replyContentLabel = [[UILabel alloc] initWithFrame:[replyFrame replyContentF]];
- _replyContentLabel.backgroundColor = [UIColor clearColor];
- _replyContentLabel.font =logContentTextFont;
- _replyContentLabel.numberOfLines=0;
- _replyContentLabel.textColor = LabelGrayTextColor;
- [self.contentView addSubview:_replyContentLabel];
- NSString *replyContent=[_replyInfo replyContent];
- _replyContentLabel.text=replyContent;
- }
- else{
- _replyContentLabel = [[UILabel alloc] initWithFrame:[replyFrame replyContentF]];
- _replyContentLabel.backgroundColor = [UIColor clearColor];
- _replyContentLabel.textColor = LabelGrayTextColor;
- _replyContentLabel.font =logContentTextFont;
- _replyContentLabel.numberOfLines=0;
- [self.contentView addSubview:_replyContentLabel];
- NSString *replyContent=[_replyInfo replyContent];
- _replyContentLabel.text=replyContent;
-
- }
-
-
-
- }
- else{
- _replyContentLabel = [[UILabel alloc] initWithFrame:[replyFrame replyContentF]];
- _replyContentLabel.backgroundColor = [UIColor clearColor];
- _replyContentLabel.textColor = LabelGrayTextColor;
- _replyContentLabel.font =logContentTextFont;
- _replyContentLabel.numberOfLines=0;
- [self.contentView addSubview:_replyContentLabel];
- NSString *replyContent=[_replyInfo replyContent];
- _replyContentLabel.text=replyContent;
- }
-
- }
-
-
-
-
- }
- //回复按钮点击事件
- - (void)answerButtonDidClicked:(UIButton *)sender {
-
- if ([self.delegate respondsToSelector:@selector(ShowOperationView:replyInfo:)]) {
- [self.delegate ShowOperationView:sender replyInfo:_replyInfo];
- }
- }
- @end
|