1.SDCycleScrollView不显示UIpageControl的bug。
全局搜
self.pageControl.frame = CGRectMake(x, y, size.width, size.height);
替换为
if (@available(iOS 14.0, *)) {
[self.pageControl mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.bottom.offset(-10);
make.height.offset(self.pageControlDotSize.height);
}];
}else{
self.pageControl.frame = CGRectMake(x, y, size.width, size.height);
}
2.想要自定义小圆点的样式,遍历UIPageControl的子控件修改图片崩溃报错。
初始化UIPageControl的时候
page.preferredIndicatorImage = UIImage.init(named: "默认圆点")
[self.pageControl setCurrentPage:pageIndex]的时候
if (@available(iOS 14.0, *)) {
for (int i = 0; i < self.pageControl.numberOfPages; i++) {
if (i == pageIndex) {
[self.pageControl setIndicatorImage:[UIImage imageNamed:@"选中圆点"] forPage:pageIndex];
}else{
[self.pageControl setIndicatorImage:[UIImage imageNamed:@"默认圆点"] forPage:i];
}
}
} else {
// Fallback on earlier versions
}
作者:OyesOnoOmg
链接:https://www.jianshu.com/p/82baa0a7a305
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。