

问题
之前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;
网友评论