| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- //
- // LogShareTableViewCell.m
- // IBOSS
- //
- // Created by Dongke on 15/11/4.
- // Copyright © 2015年 elongtian. All rights reserved.
- //
- #import "LogShareTableViewCell.h"
- #import "LogShareAndCommentInfoModel.h"
- @implementation LogShareTableViewCell
- -(void)parseInfoModel:(LogShareAndCommentInfoModel*)model{
- CGFloat xpadding =10;
- CGFloat ypadding =8;
-
- NSDictionary *logDict = @{NSFontAttributeName:kTextFont};
- _btnSelect=[UIButton buttonWithType:UIButtonTypeCustom];
- _btnSelect.frame=CGRectMake(8,33, 20,20);
-
- [_btnSelect addTarget:self action:@selector(btnGoCheck) forControlEvents:UIControlEventTouchUpInside];
-
- [self.contentView addSubview:_btnSelect];
- //用户名frame
- NSString *titleUserCode=@"用户编码:";
- CGRect titleUserCodeFrame = [titleUserCode textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:logDict];
-
- titleUserCodeFrame.origin.x =CGRectGetMaxX(_btnSelect.frame)+xpadding;
- 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 =CGRectGetMaxX(_btnSelect.frame)+xpadding;
- 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 =CGRectGetMaxX(_btnSelect.frame)+xpadding;
- 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];
- }
- }
- - (void) setCheckBackground: (BOOL) checked
- {
- if(!checked)
- {
- _isSelect=NO;
- [_btnSelect setBackgroundImage:[UIImage imageNamed:@"radio_unchecked.png"] forState:UIControlStateNormal];
- _btnSelect.imageEdgeInsets=UIEdgeInsetsMake(11,11,11,11);
-
- }
- else
- {
- _isSelect=YES;
-
- [_btnSelect setBackgroundImage:[UIImage imageNamed:@"radio_checked.png"] forState:UIControlStateNormal];
- _btnSelect.imageEdgeInsets=UIEdgeInsetsMake(11,11,11,11);
- }
-
- }
- @end
|