美文网首页
简单适配iOS 11 tableView 刷新问题

简单适配iOS 11 tableView 刷新问题

作者: 酥小米哇咔咔 | 来源:发表于2017-09-21 17:29 被阅读45次

    1、利用runtime方法交换机制 适配iOS11--contentInsetAdjustmentBehavior

    #import "UIScrollView+PYExtension.h"

    #import

    @implementation UIScrollView (PYExtension)

    + (void)load {

    Method systemMethod = class_getInstanceMethod(self, @selector(initWithFrame:));

    Method customMethod = class_getInstanceMethod(self, @selector(m_initWithFrame:));

    method_exchangeImplementations(systemMethod, customMethod);

    }

    - (instancetype)m_initWithFrame:(CGRect)frame {

    UIScrollView *scrollV = [self m_initWithFrame:frame];

    if (@available(iOS 11.0, *)) {

    scrollV.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;

    }

    return scrollV;

    }

    @end

    //网上有篇相似文字 是同一公司同事;

    相关文章

      网友评论

          本文标题:简单适配iOS 11 tableView 刷新问题

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