iOS之自动调节输入文本框的高度

//自动调节输入文本框的高度

- (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);

}

上一篇:jquery删除添加输入文本框


下一篇:微信小程序-form表单-获取用户输入文本框的值