1 //自动调节输入文本框的高度
 2 
 3 - (void)textViewDidChange:(UITableView *)textView{
 4 
 5     float height;
 6 
 7     if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
 8 
 9         CGRect textFrame = [[self.textView layoutManager] usedRectForTextContainer:[self.textView textContainer]];
10 
11         height = textFrame.size.height;
12 
13     }
14 
15     else{
16 
17         height = self.textView.contentSize.height;
18 
19     }
20 
21     self.textView.frame = CGRectMake(self.textView.frame.origin.x, self.textView.frame.origin.y, self.textView.frame.size.width, height);
22 
23 }
24 
25  

 

相关文章:

  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
猜你喜欢
  • 2022-12-23
  • 2021-12-21
  • 2021-08-09
  • 2022-12-23
  • 2021-11-10
  • 2021-08-01
  • 2022-12-23
相关资源
相似解决方案