美文网首页iOS开发
解决iOS 11 tableView截长图不全 contentS

解决iOS 11 tableView截长图不全 contentS

作者: ElegantLiar | 来源:发表于2017-11-08 17:58 被阅读71次
错误展示.png
正常展示.png

问题

之前APP内截取tableView长图在iOS 11以下的机型可以正常运行,但是iOS 11系统却只能截图当前屏幕范围内的图片,如下图所示

原因

IOS11以后,Self-Sizing默认开启,包括Headers, footers。如果项目中没使用estimatedRowHeight属性,在IOS11下会有奇奇怪怪的现象,因为IOS11之前,estimatedRowHeight默认为0,Self-Sizing自动打开后,contentSize和contentOffset都可能发生改变。可以通过设置tableView的estimatedRowHeight、estimatedSectionHeaderHeight、estimatedSectionFooterHeight属性为0来关闭Self-Sizing。

解决方法

在对应的tableView处设置如下属性,关闭Self-Sizing。

_tableView.estimatedRowHeight = 0; 
_tableView.estimatedSectionHeaderHeight = 0; 
_tableView.estimatedSectionFooterHeight = 0;

相关文章

网友评论

本文标题:解决iOS 11 tableView截长图不全 contentS

本文链接:https://www.haomeiwen.com/subject/fxpymxtx.html