1.添加控件
_yyContentDetailView = [[UITextView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_yyContentLabel.frame), CGRectGetMinY(_yyContentLabel.frame)-6, [DeviceInfo ScreenSize].width-(CGRectGetMaxX(_yyContentLabel.frame)+margin)-margin, CGRectGetHeight(_yyContentLabel.frame)*2)];
[_yyContentDetailView setTag:8000];
[_yyContentDetailView setFont:_yyContentLabel.font];
[_yyContentDetailView setDelegate:self];
[_yyContentDetailView setReturnKeyType:UIReturnKeyDone];
[self addSubview:_yyContentDetailView];
self.textViewLabel = [[UILabel alloc]initWithFrame:CGRectMake(3, 6, 200, 20)];
[self.textViewLabel setLayoutMargins:UIEdgeInsetsZero];
self.textViewLabel.enabled = NO;
self.textViewLabel.text = @"请输入您的宝贵意见";
self.textViewLabel.font = _yyContentDetailView.font;
self.textViewLabel.textColor = [UIColor lightGrayColor];
[_yyContentDetailView addSubview:self.textViewLabel];
2.控制textViewLabel的显示与隐藏
- (void) textViewDidChange:(UITextView *)textView{
if ([textView.text length] == 0) {
[self.textViewLabel setHidden:NO];
}else{
[self.textViewLabel setHidden:YES];
}
}