添加占位符: 首先占位符的大小要比textView 的大小要小一些
1、添加一个取消键盘的通知
2、添加一个代理事件
1、
// removeKeyBoard 添加通知收回键盘
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(removeKeyBoard:) name:@"removeKeyBoard" object:nil];
//removeKeyBoard 实现通知的事件
-(void)removeKeyBoard:(NSNotification*)noti{
[self.ContenttText resignFirstResponder];
}
2、
#pragma mark-textviewDelegate
- (void)textViewDidChange:(UITextView *)textView{
self.placeLabel.hidden = textView.text.length;
}
转载于:https://www.cnblogs.com/lishanshan/p/5702847.html