zoukankan      html  css  js  c++  java
  • [iOS11] contentInsetAdjustmentBehavior 问题, push back时, 界面会上下移动.

    https://stackoverflow.com/questions/45573829/weird-uitableview-behaviour-in-ios11-cells-scroll-up-with-navigation-push-anima

    在你的tablview/controller基类设置

     if (@available(ios 11.0,*)) {
            self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        }

    不要用  `[UIScrollView appearance]` 的方法, 不生效.

    PS: 搜索这个问题的话, 国内的多个文章都是抄的同一篇, 且是错的.

    如下是错的.

    1. 目前发现所有的Scrollview 及其子类都需要设置 contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever ,  
    2. 工程中大量使用列表的同学不要慌,不要忙,因为UIView及其子类都遵循UIAppearance协议,我们可以进行全局配置:    
    3.     
    4. // AppDelegate 进行全局设置    
    5.     if (@available(iOS 11.0, *)){    
    6.         [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];    
    7.     }    
    8.     
    9. 这样一来使用UITableview 、UICollectionView、UIScrollview的时候就不需要再单独设置该属性了。  
  • 相关阅读:
    dayfunctools.weps 定义函数装饰器
    python3之concurrent.futures一个多线程多进程的直接对接模块,python3.2有线程池了
    python的类的super()
    django的admin
    python的单例模式
    git指南
    django创建验证码
    Django model对象接口
    Go语言基础
    迭代器&迭代对象&生成器
  • 原文地址:https://www.cnblogs.com/willbin/p/7802830.html
Copyright © 2011-2022 走看看