// // LogCommentTableViewCell.m // IBOSS // // Created by Dongke on 15/11/2. // Copyright © 2015年 elongtian. All rights reserved. // #import "LogCommentTableViewCell.h" #import "LogShareAndCommentInfoModel.h" @implementation LogCommentTableViewCell -(void)parseInfoModel:(LogShareAndCommentInfoModel*)model{ CGFloat xpadding =10; CGFloat ypadding =8; NSDictionary *logDict = @{NSFontAttributeName:kTextFont}; NSString *titleUserCode=@"用户编码:"; CGRect titleUserCodeFrame = [titleUserCode textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:logDict]; titleUserCodeFrame.origin.x =20; titleUserCodeFrame.origin.y = ypadding; UILabel *lblTitleUserCode=[[UILabel alloc]init]; lblTitleUserCode.backgroundColor = [UIColor clearColor]; lblTitleUserCode.frame=titleUserCodeFrame; lblTitleUserCode.text=titleUserCode; lblTitleUserCode.textColor = [UIColor lightGrayColor]; lblTitleUserCode.font =kTextFont; [self.contentView addSubview:lblTitleUserCode]; NSString *userCode= [model userCode]; CGRect userCodeFrame = [userCode textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:logDict]; userCodeFrame.origin.x =CGRectGetMaxX(titleUserCodeFrame)+xpadding; userCodeFrame.origin.y = ypadding; _lblUserCode=[[UILabel alloc]init]; _lblUserCode.backgroundColor = [UIColor clearColor]; _lblUserCode.frame=userCodeFrame; _lblUserCode.text=userCode; _lblUserCode.numberOfLines=0; _lblUserCode.textColor = [UIColor lightGrayColor]; _lblUserCode.font =kTextFont; [self.contentView addSubview:_lblUserCode]; NSString *titleUserName=@"用户姓名:"; CGRect titleUserNameFrame = [titleUserName textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:logDict]; titleUserNameFrame.origin.x =20; titleUserNameFrame.origin.y = CGRectGetMaxY(titleUserCodeFrame)+ypadding; UILabel *lblTitleUserName=[[UILabel alloc]init]; lblTitleUserName.backgroundColor = [UIColor clearColor]; lblTitleUserName.frame=titleUserNameFrame; lblTitleUserName.text=titleUserName; lblTitleUserName.textColor = [UIColor lightGrayColor]; lblTitleUserName.font =kTextFont; [self.contentView addSubview:lblTitleUserName]; //用户名frame NSString *userName= [model userName]; CGRect userNameFrame = [userName textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:logDict]; userNameFrame.origin.x =CGRectGetMaxX(titleUserNameFrame)+xpadding; userNameFrame.origin.y = CGRectGetMaxY(titleUserCodeFrame)+ypadding; _lblUserName=[[UILabel alloc]init]; _lblUserName.backgroundColor = [UIColor clearColor]; _lblUserName.frame=userNameFrame; _lblUserName.numberOfLines=0; _lblUserName.text=userName; _lblUserName.textColor = [UIColor lightGrayColor]; _lblUserName.font =kTextFont; [self.contentView addSubview:_lblUserName]; NSString *titleOrganization=@"所属部门:"; CGRect titleOrganizationFrame = [titleOrganization textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:logDict]; titleOrganizationFrame.origin.x =20; titleOrganizationFrame.origin.y = CGRectGetMaxY(titleUserNameFrame)+ypadding; UILabel *lblTitleOrganization=[[UILabel alloc]init]; lblTitleOrganization.backgroundColor = [UIColor clearColor]; lblTitleOrganization.frame=titleOrganizationFrame; lblTitleOrganization.text=titleOrganization; lblTitleOrganization.textColor = [UIColor lightGrayColor]; lblTitleOrganization.font =kTextFont; [self.contentView addSubview:lblTitleOrganization]; NSString *organization= [model orgName]; CGRect organizationFrame = [organization textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:logDict]; organizationFrame.origin.x =CGRectGetMaxX(titleOrganizationFrame)+xpadding; organizationFrame.origin.y = CGRectGetMaxY(titleUserNameFrame)+ypadding; _lblOrg=[[UILabel alloc]init]; _lblOrg.backgroundColor = [UIColor clearColor]; _lblOrg.frame=organizationFrame; _lblOrg.text=organization; _lblOrg.numberOfLines=0; _lblOrg.textColor = [UIColor lightGrayColor]; _lblOrg.font =kTextFont; [self.contentView addSubview:_lblOrg]; _separatorView=[UIView new]; _separatorView.frame=CGRectMake(0, CGRectGetMaxY(titleOrganizationFrame)+ypadding, Screen_Width,1); _separatorView.backgroundColor=LineBackgroundColor; [self.contentView addSubview:_separatorView]; _userId=model.userId; } - (CGFloat)height{ CGFloat height= CGRectGetMaxY(_separatorView.frame); return height; } -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]; if(self){ } return self; } -(void)btnGoCheck{ if ([self.delegate respondsToSelector:@selector(btnCheckPressed:)]) { [self.delegate btnCheckPressed:self]; } } @end