大夏VIEW使用技巧

HDXTextView *remark=[[HDXTextView alloc] initWithFrame:CGRectMake(leftmargin-5,labbackView.top, cellContentView.width-2*leftmargin+10, txtViewHeight)];
remark.tag=indexPath.row;
remark.layer.borderWidth=0.5;
remark.layer.borderColor=[Toolobject hexStringToColor:@"ffffff" ].CGColor;
[cellContentView addSubview:remark];
remark.font=[UIFont systemFontOfSize:12];
remark.placeholder=@"请填写任务异常说明 (必填)";
remark.placeholderColor=[Toolobject hexStringToColor:@"cfcfcf" ];
remark.surplusLblPlaceholderSizelen=500;
remark.surplusLblPlaceholder=@"还可输入500字";
remark.surplusLblPlaceholderColor=[Toolobject hexStringToColor:@"cfcfcf" ];
cellContentView.height=remark.bottom+25;
if(![self isEditingException]){
remark.editable=NO;
remark.placeholder=@"";
remark.textColor=[Toolobject hexStringToColor:@"666666" ];
remark.text=[NSString stringWithFormat:@"异常说明: %@",[dict objectForKey:@"content"]];
cellContentView.height=remark.bottom+5;
}
__weak typeof(remark) weakRemark=remark;
remark.editblock=^(NSString *strcontent){
//修改输入内容
if(self.tableArray.count<=remark.tag){
[weakRemark resignFirstResponder];
return ;
}
NSMutableDictionary *dict=[NSMutableDictionary dictionaryWithDictionary:[self.tableArray objectAtIndex:weakRemark.tag]];
[dict setObject:strcontent forKey:@"content"];
[self.tableArray setObject:dict atIndexedSubscript:weakRemark.tag];
};

posted @ 2016-06-22 16:55  ID_超电磁炮  阅读(142)  评论(0编辑  收藏  举报