//自动调节输入文本框的高度
- (void)textViewDidChange:(UITableView *)textView{
float height;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
CGRect textFrame = [[self.textView layoutManager] usedRectForTextContainer:[self.textView textContainer]];
height = textFrame.size.height;
}
else{
height = self.textView.contentSize.height;
}
self.textView.frame = CGRectMake(self.textView.frame.origin.x, self.textView.frame.origin.y, self.textView.frame.size.width, height);
}
时间: 2024-10-07 02:59:31