From 803a4da8ab9985c9202333bddf9945338d4a9725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=B0=B8=E8=83=BD?= <1003580893@qq.com> Date: Fri, 20 Jul 2018 10:13:17 +0800 Subject: [PATCH] - update adapter less than ios11 --- .../YNPageViewController/Category/UIView+YNPageExtend.h | 2 ++ .../Libs/YNPageViewController/YNPageViewController.m | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/YNPageViewController/YNPageViewController/Libs/YNPageViewController/Category/UIView+YNPageExtend.h b/YNPageViewController/YNPageViewController/Libs/YNPageViewController/Category/UIView+YNPageExtend.h index aca2698..f7c6cb9 100644 --- a/YNPageViewController/YNPageViewController/Libs/YNPageViewController/Category/UIView+YNPageExtend.h +++ b/YNPageViewController/YNPageViewController/Libs/YNPageViewController/Category/UIView+YNPageExtend.h @@ -18,6 +18,8 @@ #define kYNPAGE_TABBARHEIGHT (kYNPAGE_IS_IPHONE_X ? 83 : 49) +#define kLESS_THAN_iOS11 ([[UIDevice currentDevice].systemVersion floatValue] < 11.0 ? YES : NO) + @interface UIView (YNPageExtend) @property (nonatomic, assign) CGFloat yn_x; diff --git a/YNPageViewController/YNPageViewController/Libs/YNPageViewController/YNPageViewController.m b/YNPageViewController/YNPageViewController/Libs/YNPageViewController/YNPageViewController.m index 32add20..30193a1 100644 --- a/YNPageViewController/YNPageViewController/Libs/YNPageViewController/YNPageViewController.m +++ b/YNPageViewController/YNPageViewController/Libs/YNPageViewController/YNPageViewController.m @@ -462,7 +462,9 @@ - (void)setupPageScrollView { self.config.contentHeight = self.pageScrollView.yn_height; [self.bgScrollView addSubview:self.pageScrollView]; - + if (kLESS_THAN_iOS11) { + [self.view addSubview:[UIView new]]; + } [self.view addSubview:self.bgScrollView]; } else { @@ -472,7 +474,9 @@ - (void)setupPageScrollView { self.pageScrollView.contentSize = CGSizeMake(kYNPAGE_SCREEN_WIDTH * self.controllersM.count, contentHeight - ([self isTopStyle] ? self.config.menuHeight : 0)); self.config.contentHeight = self.pageScrollView.yn_height - self.config.menuHeight; - + if (kLESS_THAN_iOS11) { + [self.view addSubview:[UIView new]]; + } [self.view addSubview:self.pageScrollView]; } } @@ -734,6 +738,7 @@ - (UIScrollView *)getScrollViewWithPageIndex:(NSInteger)pageIndex { if (scrollView) { scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; } + } else { } } NSAssert(scrollView != nil, @"请设置pageViewController 的数据源!");