Skip to content

Commit

Permalink
修复iOS14上系统自带pagecontrol显示不出来bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoshaodong committed Oct 31, 2020
1 parent 84756f9 commit 7b1fdda
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions SDCycleScrollView/Lib/SDCycleScrollView/SDCycleScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,13 @@ - (void)layoutSubviews
size = [pageControl sizeForNumberOfPages:self.imagePathsGroup.count];
} else {
size = CGSizeMake(self.imagePathsGroup.count * self.pageControlDotSize.width * 1.5, self.pageControlDotSize.height);
// ios14 需要按照系统规则适配pageControl size
if (@available(iOS 14.0, *)) {
if ([self.pageControl isKindOfClass:[UIPageControl class]]) {
UIPageControl *pageControl = (UIPageControl *)_pageControl;
size.width = [pageControl sizeForNumberOfPages:self.imagePathsGroup.count].width;
}
}
}
CGFloat x = (self.sd_width - size.width) * 0.5;
if (self.pageControlAliment == SDCycleScrollViewPageContolAlimentRight) {
Expand Down

0 comments on commit 7b1fdda

Please sign in to comment.