uiscrollview-setcontentoffsetanimated-not-working-in-ios11 评论中找答案
如题:这种情况一般发生在UITableView上,UIScrollView没有类似问题
_tableView.estimatedRowHeight = 0;// default is UITableViewAutomaticDimension, set to 0 to disable
_tableView.estimatedSectionHeaderHeight =0;// default is UITableViewAutomaticDimension, set to 0 to disable
_tableView.estimatedSectionFooterHeight =0; // default is UITableViewAutomaticDimension, set to 0 to disable
设置三种属性即可解决
iOS11 UITableView push 返回后有一个向下的动画
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.never
} else {
// Fallback on earlier versions
}
if (@available(iOS 11.0, *)) {
[UIScrollView appearance].contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
网友评论