iOS之自动调节输入文本框的高度
2016-01-28 10:23
288 查看
//自动调节输入文本框的高度
- (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);
}
- (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);
}
相关文章推荐
- iOS下载大文件原理解析一
- iOS开发常用第三方库
- IOS通讯录分区section汉字转拼音截取首字母
- iOS 中代码获取当前版本号
- iOS中 基于LBXScan库二维码扫描 韩俊强的博客
- iOS中 基于LBXScan库二维码扫描 韩俊强的博客
- runtime API
- ios手机号正则表达式
- iOS 时间戳和标准时间的转换
- iOS btn文字居左
- iOS更改状态栏字体颜色
- Xcode之外的文档浏览工具--Dash (在iOS代码库中浏览本帖)
- iOS之隐藏键盘的方式
- iOS 控制器的三种创建方式
- iOS中下载小文件
- ios打包 蒲公英生成二维码扫描下载
- iOS设计模式——单例模式
- iOS程序猿之iOS动画基础
- iOS 判断邮箱格式是否正确的代码
- 【IOS工具类】获得设备唯一标识(兼容IOS5,6,7)